Skip to content

Instantly share code, notes, and snippets.

@yzorg
Created October 5, 2017 19:53
Show Gist options
  • Save yzorg/d7d84318699f1b43017bd0f46ac176e4 to your computer and use it in GitHub Desktop.
Save yzorg/d7d84318699f1b43017bd0f46ac176e4 to your computer and use it in GitHub Desktop.
USE [MyAppDatabase]
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('dbo.spAppUserSave'))
EXEC('CREATE PROCEDURE [dbo].[spAppUserSave] AS BEGIN SET NOCOUNT ON; /* invalid empty SPROC */ END')
GO
SET ANSI_NULLS OFF
SET QUOTED_IDENTIFIER OFF
GO
-- Author: Chris Tracy
ALTER PROCEDURE [dbo].[spAppUserSave]
@CurrentUser NVARCHAR(MAX),
@UserId BIGINT
-- ...
AS
BEGIN
SET NOCOUNT OFF;
-- do real SPROC work here
END
GO
@yzorg
Copy link
Author

yzorg commented Oct 5, 2017

I've had to re-create the top IF .. EXISTS ... EXEC('CREATE PROC..' many times (when I wipe my computer, or change jobs). The rest is just template for basic syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment