Need Help

  • if i run the following query

    declare @sql varchar(7000)

    set @sql = 'select * into #mytemp  from <Your Table Name> '

    exec (@sql)

    SELECT * FROM #mytemp

    DROP TABLE #mytemp

    getting

    Server: Msg 208, Level 16, State 1, Line 6

    Invalid object name '#mytemp'.

    Please help me.

    Thanks in advance.

  • The table is created then dropped within the exec () statement

    try :

    set @sql = 'select * into #mytemp from ;

    SELECT * FROM #mytemp'

    exec (@sql)

  • The name of the problem is : OUT OF SCOPE 

     


    * Noel

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

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