Showing posts with label stored procedure naming standards. Show all posts
Showing posts with label stored procedure naming standards. Show all posts

Tuesday, October 9, 2007

Stored Procedure Guidelines

Naming conventions:

proc_[maintable][function(optional)]_insert - Insert
proc_[maintable][function(optional)]_select - Select
proc_[maintable][function(optional)]_delete - Delete
proc_[maintable][function(optional)]_update - Update

Select Example:

-- ================================================
-- 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: Joe Bailey
-- Create date: 10/09/2007
-- Description: Gathers all values from the xyz database
-- =============================================
CREATE PROCEDURE [dbo].[xyz_Select]
-- Add the parameters for the stored procedure here
@xyzID int
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 xyzName,xyzPage, xyzPageTitle, xyzMetaDescription, xyzMetaKeywords
FROM XYZ
WHERE xyzID=@xyzID
END
GO