26 May 2012

SQL Server Where 1=0

SQL Server Where 1=0

Used in both static and dynamic query.

WHERE 1 = 0 (or any always false condition) 

It is used to create a table of identical structure, sans data: In the below query empty table is created in the same structure.
SELECT * INTO dbo.NewTable FROM dbo.SomeTable WHERE 0 = 1;

No comments:

Post a Comment

Comments Welcome

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...