add stored procedures .sql to database
-
I have what I hope is a simple question. I'm trying a product called RapTier from Sharp Power that generates a data access layer. One of the options it has is to produce stored procedures from my database. I've looked through the generated stored procedures, and they seem pretty good. My problem is this, I have the stored procedures as a .sql file, and I have to figure out how to actually attach/add them to the database that I have (I'm using MSDE 2000). Can anyone give me a hand on how to do this? Thanks. The ends can never justify the means. It is the means that determine the ends.
-
I have what I hope is a simple question. I'm trying a product called RapTier from Sharp Power that generates a data access layer. One of the options it has is to produce stored procedures from my database. I've looked through the generated stored procedures, and they seem pretty good. My problem is this, I have the stored procedures as a .sql file, and I have to figure out how to actually attach/add them to the database that I have (I'm using MSDE 2000). Can anyone give me a hand on how to do this? Thanks. The ends can never justify the means. It is the means that determine the ends.
You can actually hurl any SQL (including a code-generated script) through a regular SqlCommand object. A few months ago I wrote a simple application to demonstrate that - It picks up a file and dumps the contents to a SQL Server via the SqlCommand object in .NET You can find the download here[^] Does this help?
My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
-
You can actually hurl any SQL (including a code-generated script) through a regular SqlCommand object. A few months ago I wrote a simple application to demonstrate that - It picks up a file and dumps the contents to a SQL Server via the SqlCommand object in .NET You can find the download here[^] Does this help?
My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
OK, I don't really understand your response, to tell the truth. I'll go to your site and take a look at the utility, maybe it can help. What I'm really looking for (I think) is just the command I need to feed OSQL to get it to go find my .sql file and add it to the database. I'm not sure if that is equivalent to "hurl[ing] any SQL through a regular SqlCommand object" or not. Thanks for the reply though! The ends can never justify the means. It is the means that determine the ends.
-
OK, I don't really understand your response, to tell the truth. I'll go to your site and take a look at the utility, maybe it can help. What I'm really looking for (I think) is just the command I need to feed OSQL to get it to go find my .sql file and add it to the database. I'm not sure if that is equivalent to "hurl[ing] any SQL through a regular SqlCommand object" or not. Thanks for the reply though! The ends can never justify the means. It is the means that determine the ends.
I think what he meant was "why don't you just go read the .sql file into the commandtext property of a sql command object and executenonquery". The only thing you need to be careful of is "go", but I also read in another post that colin wrote a utility to help with sql containing "go" in it.
-
I have what I hope is a simple question. I'm trying a product called RapTier from Sharp Power that generates a data access layer. One of the options it has is to produce stored procedures from my database. I've looked through the generated stored procedures, and they seem pretty good. My problem is this, I have the stored procedures as a .sql file, and I have to figure out how to actually attach/add them to the database that I have (I'm using MSDE 2000). Can anyone give me a hand on how to do this? Thanks. The ends can never justify the means. It is the means that determine the ends.
If it's a local instance of MSDE, use the following command:
osql -E -i filename.sql
The
-E
switch indicates to use Windows authentication, and the-i filename.sql
indicates which file contains the statements to run. Runosql /?
to see other options. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005