Building / Executing a Select statement

  • I'm using a stored procedure to build a complex Select statement based on parameters passed to it. That part is going ok, but I'm not sure how to execute the select statement once it is stored in a variable. Thank you in advance...

  • This is part of a script that has the set statement and then the execute statement.

    set @sqlstring = ('dbcc checkident '+@tab_name+')')

    exec (@sqlstring)

    Let me know if you need more detail than that or, post some code we can look at.

    David

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • I think that will do it. I should have guessed it would be something simple. Thanks for your help.

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

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