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
 Where to save stored procedures?

Author  Topic 

Starlet_GT
Yak Posting Veteran

81 Posts

Posted - 2007-09-07 : 01:21:33
In SQL Server 2000 when we use to create a new procedure it was saved in Management Consule, but when I create a new procedure and wants to save it SQL Server 2005 (Management Console) ... it saved like a query on my local drive ... I am confused what to do ... if i save it on local drive then how can i call it when required.

Thanks in Advance ...

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-09-07 : 04:45:09
stored procedurea are database objects.
when you run a Create procedure statement they get created in the database.
saving in SSMS is just saving the stored procedure definition in a .sql file.
you still have to create it in sql server.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Starlet_GT
Yak Posting Veteran

81 Posts

Posted - 2007-09-07 : 07:09:42
how to create it in SQL Server? Please explain

Thanks in advance
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-09-07 : 07:21:40
create procedure ProcName
-- input parameters here
as
-- your procedure body here
go


look in books online = BOL = SQL server help for complete syntax


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Starlet_GT
Yak Posting Veteran

81 Posts

Posted - 2007-09-07 : 09:05:50
Sorry I asked the wrong question ... I actually wants to know how to save a procedure in SQL Server? after creating it ...
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-09-07 : 09:08:37
stored procedure is created in sql server.

i think don't quite understand how this works...
can you explain your understanding?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Vijaykumar_Patil
Posting Yak Master

121 Posts

Posted - 2007-09-07 : 09:43:03
Startlet,..if you have created a stored procedure..it is saved also ..you will find under the database you created in and in Programmabilty , under stored procedures. If this is what you want to know.

Necessity is the mother of all inventions!
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-09-07 : 22:29:38
It's stored in syscomments table if you like to know more.
Go to Top of Page

Starlet_GT
Yak Posting Veteran

81 Posts

Posted - 2007-09-08 : 02:58:43
When I create a stored procedure and click save button ... it open a dialog box on my local drive and try to save it with *.SQL ...but ideally it should save it under programmability ... thats what I wanna know ... Thx in advance.
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-09-08 : 08:42:40
quote:
Originally posted by Starlet_GT

When I create a stored procedure and click save button ... it open a dialog box on my local drive and try to save it with *.SQL ...but ideally it should save it under programmability ... thats what I wanna know ... Thx in advance.



When you create the stored procedure you use CREATE PROCEDURE right? If you format the CREATE PROCEDURE and then EXECUTE it will save it in programmability in the current or specified database. If you then click on SAVE in the file menu it is going to save the actual SQL script used to create the proc, these are two different things.



Future guru in the making.
Go to Top of Page
   

- Advertisement -