Dynamic SQL in dataset

  • Hi All,

    I am trying to get the following code in a dataset but it says incorrect syntax near "=". Can anybody please help?

    ="IF" & Parameters!Department.Value & "= 'Mkg'

    BEGIN

    Exec " & Parameters!Department.Value & ".dbo.sp_storedprocedure1

    END

    ELSE

    BEGIN

    Exec " & Parameters!Department.Value & ".dbo.sp_storedprocedure2

    END"

  • Where exactly are you trying to do this?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 2 posts - 1 through 1 (of 1 total)

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