Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Not able to use the Query Hint inside the IF Exists clause

$
0
0

Hi there,

For one my query i am not able to use the query hint plan inside the IF exists clause. For Example: 

 IF EXISTS(SELECT 1 FROM Person.Person a
           INNER JOIN Person.BusinessEntity b ON a.BusinessEntityID = b.BusinessEntityID
           OPTION (FORCE ORDER))
 BEGIN 
 PRINT 'Hello World!' 
 END

The above can't be parsed, whereas query mentioned below works:

SELECT 1 FROM Person.Person a
           INNER JOIN Person.BusinessEntity b ON a.BusinessEntityID = b.BusinessEntityID
           OPTION (FORCE ORDER))

Can you please let me know how to specify the query hint inside the if exists clause.

Regards

Harsh


Regards Harsh


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>