Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
nitin05.sharma
Starting Member
20 Posts |
Posted - 2011-12-02 : 02:30:10
|
| hi, i have some problem with sql that when i am executing a procedure then will genrate an result set you can say that'll give table i don't know how many columns are there i want insert that table into a dynamically created temp table, CREATE PROC spTest AS begin select id, name, message from tabl_name end exec spTest this procedure will return a table i want to insert this table into a temp table reply me as soon as possible ites urgent thanks to all in advance |
|
|
sureshkk
Starting Member
21 Posts |
Posted - 2011-12-02 : 02:40:47
|
| SELECT * INTO #TEST FROM OPENROWSET('SQLNCLI','Server=yourservername;Uid=userid;Pwd=pwd;Database=yourdatabase','EXEC spTest') |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-02 : 03:08:57
|
Please note that for using OPENROWSET you've to set ahhoc distributed queries option to 1 which under defaults is not setIf you want to set it, use below querysp_configure 'show advanced options', 1;RECONFIGURE;sp_configure 'Ad Hoc Distributed Queries', 1;RECONFIGURE;GO ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
nitin05.sharma
Starting Member
20 Posts |
Posted - 2011-12-02 : 03:43:27
|
| can i use teble variable in temp table |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-02 : 03:45:12
|
quote: Originally posted by nitin05.sharma can i use teble variable in temp table
what does that men?whats the need of using table variable inside temporary table? can you explain what you're trying to achieve?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|