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 2008 Forums
 Transact-SQL (2008)
 data transfer between 2 servers

Author  Topic 

wided
Posting Yak Master

218 Posts

Posted - 2011-06-09 : 11:00:20
hello

I have a stored procedure that inserts the data into a table on server2 from server1

the name of my second server is often variable

my query is:
insert into [server2].database2.table1
select a, b, c from database1.table1

I want [server2] is variable

what should I do?

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2011-06-09 : 11:07:20
you need to do this either in SSIS or dynamic query which is not recommended because you could expose your database to sql injection. Do you know how to do SSIS.

If you don't have the passion to help people, you have no passion
Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2011-06-09 : 11:10:27
i can't use SSIS because, il do treatment before transfert

thank you for your help
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2011-06-09 : 11:26:25
you can do 'treatment' before transfer in SSIS.

If you don't have the passion to help people, you have no passion
Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2011-06-09 : 12:07:33
yes i can

but me query is not possible?
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2011-06-09 : 13:26:03
yes it is possible. look into SSIS or dynamic sql

If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -