Skip to content

Instantly share code, notes, and snippets.

@sinairv
Created September 17, 2012 06:47
Show Gist options
  • Save sinairv/3735883 to your computer and use it in GitHub Desktop.
Save sinairv/3735883 to your computer and use it in GitHub Desktop.
Template for creating and testing SQL views
-- Template for creating and testing SQL views
IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'vSomeView')
DROP VIEW [dbo].[vSomeView]
GO
CREATE VIEW [dbo].[vSomeView] AS
SELECT * FROM SomeTable
GO
SELECT * FROM [dbo].[vSomeView]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment