I want to declare a server name and use this name in an insert statement. So far all i got is an error message.
declare @machine nvarchar(6);
declare @bar nvarchar(3);
set @machine = 'Name00';
set @bar = 'foo'
insert into @machine.dbname.dbo.table (column1, column2)
select (column1, column2)
from table
where column1 = @bar
This gives me:
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near '.'.