Getting Started with Adobe After Effects - Part 6: Motion Blur
A collection of quick technology learning tips from what people around you learn every day

Top 0 will return resultset without data

Jun 2 2011 4:39AM by Madhivanan   

Like you use where 1=0 to return empty resultset, you can also use SELECT top 0 * from table to return resultset without data

Read More..   [0 clicks]

Published under: SQL Server Tips ·  ·  ·  · 


Madhivanan
3 · 39% · 12430
9
 
5
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten



Submit

1  Comments  

  • Yes, We can also use where 1=1 ro get all the data in resultset specifically we should used when we make DYNAMIC WHERE CONDITION in query like,

    DECLARE @SQL1 VARCHAR(800), @WhereCondition varchar(8000), @WhereConditionParam VARCHAR(8000);

    SET @WhereConditionParam = 'AND param = 1'; /* this is coming from proc or code*/

    SET @SQL1 = 'SELECT * FROM TABLE1'; SET @WhereCondition = 'WHERE 1=1 '; SET @WhereCondition = @WhereCondition + @WhereConditionParam ;

    SET @SQL1 = @SQL1 + @WhereCondition ;

    EXEC (@SQL1);

    commented on Jun 2 2011 6:02AM
    Paresh Prajapati
    6 · 22% · 7054

Your Comment


Sign Up or Login to post a comment.

"Top 0 will return resultset without data" rated 5 out of 5 by 9 readers
Top 0 will return resultset without data , 5.0 out of 5 based on 9 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]