Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 proper Save location for SQL stored procedures

Author  Topic 

BobLewiston
Starting Member

29 Posts

Posted - 2009-04-02 : 19:53:43
I saved a few stored procedures in SQL Server Management Studio. The default Save location, which I accepted, was C:\Documents and Settings\BobLewiston\My Documents\SQL Server Management Studio\Projects. (And yes, each stored procedure was in the form of an .sql file, and I assigned each file name root to be the same as the contained procedure's name.) But this Projects folder must be the wrong place, because my apps aren't finding these stored procedures.

I see a lot of .sql files in various places on my hard drive, but I can't find any by the names of the stored procedures listed in Management Studio's Stored Procedures folder (none of which I wrote). For that matter, I'm not even finding the Stored Procedures folder on my hard drive.

Where are stored procedures SUPPOSED to be saved?

EugeneLim11
Posting Yak Master

167 Posts

Posted - 2009-04-03 : 06:04:11
Some troubleshooting help

1. Did you run the procedures you saved in your MSSQL?
2. Are they in the databaseName > Programmibility > Store Procedures ? e.g. ASPNET > Programmibility > Store Procedures.
3. if not, can you type a simple store procedure selecting all records from a table, then click on !Execute button. Refresh the store procedures folder, and see if it is stored in the DatabaseName > Porgrammibility > Store Procedures.

:)

Regards,

Eugene

check out my blog at http://www.aquariumlore.blogspot.com
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-04-03 : 06:08:00
I think you are confused as to how stored procedures are accessed. You don't need to save them to a file storage (although it's good for documentation). You Execute the code (Create) and SQL Server stores them i.e. paste them into query pane and click "Execute" button.
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=122994
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-04-03 : 06:13:31
Make sure the database selected in dropdown is the database the procedure applies to, or add:
USE mydbName (replace with your db name) at the top of the procedure before you run it. Then make sure your apps are pointing to the correct dbname. e.g "Exec mydbName.dbo.myStoredProcedure"
Go to Top of Page

BobLewiston
Starting Member

29 Posts

Posted - 2009-04-03 : 10:39:45
Thanks everybody, problem solved. It turns out that although I had been told to save stored procedures via Ctrl-F5, it's actually F5. Again, thanks to all.
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-04-03 : 10:59:48
ctrl-f5 is parse and f5 is execute. Or else just click the buttons at top of query pane.
Go to Top of Page
   

- Advertisement -