This is my SQL syntax and (this is only a snippet unfortunately I am stuck running dynamic SQL in this instance) - but my issue is at the very end of my statement when I do the Select @numreturned
what is returned is the SQL statement NOT the actual number that is returned when I run the Exec(@numreturned)
What must I alter in order to return the NUMBER instead of the SQL Statement?
Declare @numreturned varchar(max),
@fulllocation varchar(max) = 'nagadishi.mirama.dbo.Humizan'
Set @numreturned = 'Select Count(*) FROM '+@fulllocation+' '
+'WHERE ([Nishan] IS NULL) '
Print @numreturned
Exec(@numreturned)
Select @numreturned