SQL Server determine whether there is record of a table SQL statements

SQL Server database to determine whether the record exists, either simple enough statement, and it was a great performance issues, it is simply unbearable!

If only determine whether the record exists, without the need to obtain the actual number of records in the table, recommended practices:

EXISTS the IF (the FROM dbo.TableName the SELECT. 1) 
the BEGIN 
    the PRINT '. 1'; - the presence of recording 
the END; 
the ELSE 
    the PRINT '0'; - Record does not exist

  

Guess you like

Origin www.cnblogs.com/51net/p/12514252.html