2011年7月4日 星期一

How to: Create a Stored Procedure in SQL Server 2008


To create a stored procedure

  1. In Object Explorer, connect to an instance of Database Engine and then expand that instance.
  2. Expand Databases, expand the database in which the stored procedure belongs, and then expand Programmability.
  3. Right-click Stored Procedures, and then click New Stored Procedure.
  4. On the Query menu, click Specify Values for Template Parameters.
  5. In the Specify Values for Template Parameters dialog box, the Value column contains suggested values for the parameters. Accept the values or replace them with new values, and then click OK.
  6. In the query editor, replace the SELECT statement with the statements for your procedure.
  7. To test the syntax, on the Query menu, click Parse.
  8. To create the stored procedure, on the Query menu, click Execute.
  9. To save the script, on the File menu, click Save. Accept the file name or replace it with a new name, and then click Save.

沒有留言:

張貼留言