0

I've written a few SQL stored procedures in a text editor. But how do I actually "store" them in (add them to?) a database using SQL Server 2008 Management Studio Express? I've tried to research this topic in Management Studio's onboard Help, but apparently Help assumes I know more about the subject than I actually do, because I don't even see the relevance of the answers I'm getting to my questions. Any help would be appreciated, including pointing me to a good SQL tutorial that assumes the reader knows nothing, yet teaches more than the bare-bones minimum.

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by dickersonka
0

in management studio you can use object explorer, open your database (expand), go to programmability right click on stored procedures and click new stored procedure

you can also do it manually by this

create procedure ProcedureName
as
BEGIN
... do the work here
END
0

dickersonka:

Thanks for your help.

One question: don't I have to associate a procedure with a given table? Otherwise, how will the procedure recognize the column names?

0

a procedure is not directly associated with a table, it could be a single, multiple, or no tables involved

in the section that says do your work here, lets say we are doing a single insert

create procedure ProcedureName
(
@name varchar (50)
)
as
BEGIN
  insert into TableName (NAME) 
  values (@name)
END

thats how the 'link' happens so to speak with tables

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.