Export (0) Print
Expand All

Simulating an EXISTS Clause in a Natively Compiled Stored Procedure

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Natively compiled stored procedures do not support the EXISTS clause, except in subqueries in the WHERE clause of SELECT statements.

The following is the workaround.

DECLARE @exists BIT = 0
SELECT TOP 1 @exists = 1 FROM MyTable WHERE …
IF @exists = 1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft