Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. add stored procedures .sql to database

add stored procedures .sql to database

Scheduled Pinned Locked Moved Database
databasequestionhelptutorial
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    theStorminMormon
    wrote on last edited by
    #1

    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.

    C L 2 Replies Last reply
    0
    • T theStorminMormon

      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.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      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

      T 1 Reply Last reply
      0
      • C Colin Angus Mackay

        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

        T Offline
        T Offline
        theStorminMormon
        wrote on last edited by
        #3

        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.

        S 1 Reply Last reply
        0
        • T theStorminMormon

          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.

          S Offline
          S Offline
          Scott Serl
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • T theStorminMormon

            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.

            L Offline
            L Offline
            Luis Alonso Ramos
            wrote on last edited by
            #5

            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. Run osql /? 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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups