Is it possible to use a top distinction with an output parameter in SQL?
I am trying to use the below code and getting a syntax error:
@returnParam int output = 0
Select @returnParam = top 1 Id
From table
Where xyz
Whereas taking out the top 1 the query has no errors. I could probably nest the query to get the top 1 from an inner query, but I don't think that is ideal.
Thanks!