Creating table on a different linked server

  • Using Microsoft SQL 2000

    When creating a table I want to be able to specify not only the db to create it on but also which server to create it on. I have two servers that are linked together, I can view all data without issue.

    Doing further research it looks like with the create table command you can tell it the new table name and the database but you can't tell it which server to use. Is there a way of doing this?

    Example :

    CREATE TABLE LAPTOP.database.dbo.tableName (a INT) gives the following error:

    The object name 'LAPTOP.database.dbo.' contains more than the maximum number of prefixes. The maximum is 2.

    I am new to linked servers so basically my question is, how do you point to a server within sql before I execute the create table command?

    Tx in advance

    Mark

  • You can take the help of RPC...

    exec LinkedServerName.DatabaseName.dbo.sp_executesql N'

    create table dbo.TableName  (colName Varchar(200))'

     

    MohammedU
    Microsoft SQL Server MVP

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply