Unnamed Tech Podcast

Podcast about tech news and projects.

Unnamed Tech Podcast header image 2

SQL Server 2005 Stored Procedures

June 6th, 2008 · No Comments

Posted by Ed:

I’ve been discovering SQL Server 2005 lately, and today I came across my first moment of elation for this product. This may be old news for many developers out there, but I went to create a stored procedure and the following code was automatically generated for me. Here’s the auto generated code:

– ================================================

– Template generated from Template Explorer using:

– Create Procedure (New Menu).SQL


– Use the Specify Values for Template Parameters

– command (Ctrl-Shift-M) to fill in the parameter

– values below.


– This block of comments will not be included in

– the definition of the procedure.

– ================================================

SET
ANSI_NULLS
ON

GO

SET
QUOTED_IDENTIFIER
ON

GO

– =============================================

– Author:        <Author,,Name>

– Create date: <Create Date,,>

– Description:    <Description,,>

– =============================================

CREATE
PROCEDURE
<Procedure_Name,
sysname, ProcedureName>

    – Add the parameters for the stored procedure here

    <@Param1,
sysname, @p1>
<Datatype_For_Param1,
,
int>
=
<Default_Value_For_Param1,
, 0>,

    <@Param2,
sysname, @p2>
<Datatype_For_Param2,
,
int>
=
<Default_Value_For_Param2,
, 0>

AS

BEGIN

    – SET NOCOUNT ON added to prevent extra result sets from

    – interfering with SELECT statements.

    SET
NOCOUNT
ON;


– Insert statements for procedure here

    SELECT
<@Param1,
sysname, @p1>,
<@Param2,
sysname, @p2>

END

GO

Normally I would go through some pain to generate this myself, but SQL Server 2005 gives you a great user interface for filling this information for you after hitting Ctrl-Shift-M. Here’s a screen shot of that:


I found this to be the most amazing thing and wanted to share it with the world. Some day’s it’s the little things that make me happy.

Tags: SQL

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment