May 1, 2009 at 3:47 am
hi,
i've got a job which copies tables (that dont have a primarykeyindex) from a database on my sql 2008 server to a database on my sql 2000 server.
its running as a job on the 2008 server.
the basic jist of the code is
create index i1 on server.database.dbo.table1(col1)
go
create index i2 on server.database.dbo.table2(col1)
etc
etc
the error message states that the object name contains more than the maximum number of prefixes, and that the maximum is two. is it possible to create indexes across servers?
thanks
May 2, 2009 at 8:43 am
It is not possible to be connected to one SQL Server and create an index on a different SQL Server.
It is not possible to be connected to one SQL Server and have context of a database and create an index on a different database within the same SQL Server.
SQL = Scarcely Qualifies as a Language
May 2, 2009 at 9:07 am
Hi
You can use a OPENQUERY for this:
SELECT *
FROM OPENQUERY (Local_Link_Sa, 'ALTER INDEX IX_BigTable_AnyInt ON Sandbox.dbo.BigTable REBUILD SELECT 1')
Just tried and it seems to work. You just have to select anything after the rebuild (in my case "SELECT 1").
Greets
Flo
May 5, 2009 at 2:41 am
thanks!
i've basically got this
SELECT * FROM OPENQUERY(SERVERNAME,'CREATE INDEX i1 ON DATABASENAME.dbo.TABLENAME(Col1, Col2) SELECT 1')
it doesn't error, although i've gone to enterprise manager to check the indexes and i can't see them. (i right clicked the table and selected 'design table', then right clicked a column and selected 'indexes/keys')
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply