Welcome to Sign in | Help
in Search

SELECT pe o tabela (variabila locala)

Last post 02-13-2007, 12:56 PM by Alex. 2 replies.
Sort Posts: Previous Next
  •  02-13-2007, 12:31 PM 1780

    SELECT pe o tabela (variabila locala)

    salut, revin cu o intrebare

    de ce daca rulez:

    set @strSQL='select * from TempTable order by startTime'
    exec sp_executesql @strSQL

    imi afiseaza tot ce contine tabela respectiva

    iar daca vreau sa rulez astfel:

    set @strSQL='select * from '+@gTemp_table+' order by startTime'
    exec sp_executesql @strSQL

    nu-mi afiseaza nimic dar imi spune

    The command(s) completed successfully.

    cum pot afisa ce contine respectiva tabela daca ea este o variabila locala

    multumesc

  •  02-13-2007, 12:40 PM 1782 in reply to 1780

    Re: SELECT pe o tabela (variabila locala)

    Hmm... poate @qTemp_table nu conţine numele tabelei (e NULL) ?

    Încearcă un SELECT @strSQL sau un PRINT @strSQL înainte de EXEC.

    Răzvan

  •  02-13-2007, 12:56 PM 1783 in reply to 1782

    Re: SELECT pe o tabela (variabila locala)

    intradevar  @gTemp_table NULL

    multumesc mult.....

     

View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems