Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005
    Posts
    7

    Red face Unanswered: set select + variable

    Hi ,is it possible use some statement .

    Declare @sqlCommand varchar(255) , @param int
    set select @param= param from Table where pilot= 1 .... It isn'problem



    BUt when I want use some parameter with statement, I don't know correct syntax

    Sample :


    Set Select @param= param From Table Where pilot= + @param ( @param is variable in procedure)


    Iknow statement is wrong, but is it possible make any...


    I need to write statement
    Thanks, Lubo

  2. #2
    Join Date
    May 2002
    Posts
    299
    you can do this:

    declare @para sysname -- or whatever
    ,@inpilot int

    exec sp_executesql N'select @para=param from tb where pilot=@pilot', N'@pilot int, @para sysname out', @inpilot, @para out

    print(@para)
    --
    -oj
    http://www.rac4sql.net

Posting Permissions

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