I found a cursor being used in the below SQL and dynamic SQL. Profile brings up quite a bit of execution plans and I think it has to deal with this cursor. Is this a bad choice of SQL?
SET @SelectStmtSubHeader = 'SELECT DISTINCT
dbo.dsb_testID(sh.GPCustomerID) AScursor -- RIGHT HERE
PONumber,
sh.GPCustomerID,
.....
That’s not an example of a cursor.
A cursor needs to be…
The snipped code you’ve shown appears to use a scalar function to derive a value, which it aliases to the word
cursor. But having a field calledcursordoesn’t make it a cursor.