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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 TSQL Batch: create table and the read from it

Author  Topic 

marty1976
Starting Member

22 Posts

Posted - 2011-08-05 : 07:03:10
Hi all,

I have a fairly large tsql batch containing the following steps
--create table on LS
EXECUTE ('SELECT * INTO my_temp_table FROM other_table') AT linked_server
--read table from LS
SELECT * INTO my_local_table FROM [linked_server].my_temp_table

This fails with "'my_temp_table' does not exist on the linked server".
True, but before executing the second statement I first create the said table on the said server with the first statement.

Can I change this behaviour to 'just ignore the missing table, I'm gonna take care of this'?

lappin
Posting Yak Master

182 Posts

Posted - 2011-08-08 : 10:26:55
Exec('SELECT * INTO my_local_table FROM [linked_server].my_temp_table')
Go to Top of Page
   

- Advertisement -