syntex error

  • Hello,

    It might be pretty straight forward but i am getting this syntex error on the query and i just cant see it.

    can any one help ?

    If(Select Count(*) From #Tmp T

    Join #TmpLocks TL On T.spid = TL.spid

    Where /*This is for tempdb*/ dbid = 2 And objid In (1, 2, 3)) > 0

    this is the error i am getting

    Msg 102, Level 15, State 1, Line 33

    Incorrect syntax near '0'.

    thanks in advance

  • Got your begin / end markers??

    Reformatted for my better readability :

    If (

    Select

    Count(*)

    From

    #Tmp T

    Join #TmpLocks TL

    On T.spid = TL.spid

    Where

    /*This is for tempdb*/

    dbid = 2

    And objid In ( 1 , 2 , 3 )

    ) > 0

    BEGIN

    PRINT 'has data'

    END

    ELSE

    BEGIN

    PRINT 'No data'

    END

  • Thanks,

    any one has a idea ??

  • qur7 (6/15/2011)


    Thanks,

    any one has a idea ??

    What I posted WORKS. So that means you have more code or a new error.

    Please provide whatever you left out... including the [new] error.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply