I'm having problems trying to add indexes and constraints to a table in a linked server. This is what I currently have:
Error:
Msg 117, Level 15, State 1, Line 1
The object name 'server1.db1.dbo.' contains more than the maximum number of prefixes. The maximum is 2.
Code:
SELECT @sql = 'ALTER TABLE ' + @v_listserver + '.[' + @v_listdatabase + '].dbo.' + @p_listname +
'ADD CONSTRAINT [PK_' + @p_listname + '] PRIMARY KEY CLUSTERED ([subscriber_id]) ON [PRIMARY]'
PRINT @sql EXEC sp_executesql @sql
Error:
Msg 117, Level 15, State 1, Line 1
The object name 'server1.db1.dbo.' contains more than the maximum number of prefixes. The maximum is 2.