I had a query like:
SELECT ISNULL(S.Name+'.'+T.Name,'Table Not Found') FROM DataProfile.Tables T INNER JOIN DataProfile.Schemas S ON T.schemaId=S.Id WHERE S.Name+'.'+T.Name=@TableName
Then I tried
IIF(LEN(S.Name+'.'+T.Name)>0,S.Name+'.'+T.Name,NULL)
But when it doesn’t find the named table returns not output, Value or Null value or anything I can work on.
This is going to be used as a crosscheck.
Does anybody have any idea?
Advertisement
Answer
Thanks for those who payed attention to what I exactly asked and for their responses. Here the way I tried:
DECLARE @Check NVARCHAR(MAX) = 'TABLE DOES NOT FOUND' SELECT @Check= S.Name + '.' + T.Name FROM DataProfile.Tables T INNER JOIN DataProfile.Schemas S ON T.schemaId=S.Id WHERE S.Name+'.'+T.Name=@TableName SELECT @CHECK
And That Worked for me