Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004
    Posts
    5

    Unanswered: dynamic sql and output variables

    Hi:

    Can anyone tell me if it's possible in SQL Server 2000 to build dynamically a select statement and get some values to variables (simple not tables) from the select ?

    Thanks,
    Rui Ferreira

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    sp_executesql is what you are looking for. You should be able to find usefule examples here and in BOL.
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Sep 2004
    Posts
    5
    Paul, thanks for the tip.

    At microsoft I found this:
    http://support.microsoft.com/default...b;en-us;262499

    A feature not documented! Great!

    Thanks,
    Rui Ferreira

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Well that depends...better make sure it's only a 1 row result set
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    To my knowledge this is a fairly well documented stored procedure. The usage might be a little obscure but it IS in BOL.
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

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