Skip to content

Instantly share code, notes, and snippets.

@micmaher
Created April 26, 2016 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micmaher/1068b394f3cd5e7bce7b1a66190aaed9 to your computer and use it in GitHub Desktop.
Save micmaher/1068b394f3cd5e7bce7b1a66190aaed9 to your computer and use it in GitHub Desktop.
USE [build]
GO
/****** Object: StoredProcedure [dbo].[inserthotfixPresent] Script Date: 26/04/2016 17:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*
Procedure that will allow you to update or insert the storage table.
This will make sure that there is no duplicates
*/
CREATE PROCEDURE [dbo].[inserthotfixPresent]
@hostname nvarchar(24),
@hotfixpresent char (3)
AS
IF NOT EXISTS(SELECT hostname FROM dbo.hotfixpresent WHERE hostname = @hostname)
BEGIN
INSERT INTO dbo.hotfixPresent VALUES(@hostname, @hotfixpresent, GETDATE())
END;
ELSE
BEGIN
UPDATE dbo.hotfixpresent
SET hotfixpresent =@hotfixpresent, lastupdate = GETDATE()
WHERE hostname=@hostname
END;
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment