I want to run an if exists statement to see if some sql retuns true.
i have got a simple statement to work
if exists(select * from imagebank1)
what i want to be able to do is test a more complecated statment with contains variables.
so is it possible to do if exists(@sql)
the @sql is equal to
set @sql ='SELECT [KEY],RANK,imageID,imagename, txtdescription,Metkeyword,
FROM CONTAINSTABLE(imagebankmeta1,*,'''+@schParam+''') C
JOIN imagebankmeta1 P
ON P.imageID = C.[KEY]
where rank > 5
'+ @SchPict +
' ORDER BY RANK DESC'
I have read about it but have not put it in to any of my procedures.
how could i utilise this function
would i call my seq first and then do the @@rowcount to see if no results have been returned then run some other sql ...
the recordset from the procedure is been sent to an ASP page which then displays the results. So if i checked the sql after it had run i would have some how delay the recodset been set to the asp page until it had been passed through a checker of some kind..
sorry but my knowledge of stored procedures is limited.
The solution really depends on what you are trying to accomplish. Could you explain in greater detail what you are doing - are you checking the existence of rows within the stored procedure or asp - does it matter ?