Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2002
    Posts
    2

    Unanswered: if exisits statement

    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)
    execute things

    this works.
    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,
    metsystamatic,MetSubjectArea,MetType,PictURL, PictFileURL
    FROM CONTAINSTABLE(imagebankmeta1,*,'''+@schParam+''') C
    JOIN imagebankmeta1 P
    ON P.imageID = C.[KEY]
    where rank > 5
    '+ @SchPict +
    ' ORDER BY RANK DESC'


    any help much appreciated
    thanks

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Have you tried @@rowcount ?

  3. #3
    Join Date
    Jul 2002
    Posts
    2
    No.
    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.

    thanks
    john

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    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 ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •