How to copy a table definition and data from one db to another?

  • Hi,

    table2 and table1 having same defination?

    Can you post error message?

    Regards,

    Anil Kumar

  • AnilKumar,

    Yes, table1 and 2 are of exactly same defintion. I tried without table2 too. INTO clause suppose to create the table. Nevertheless, following error message is the same whether I have preexisting table 2 or not.

    Error: invalid database object FirstDB.dbo.table1 is not found.

    I discovered something new. My query works if both databases are created from scratch but doesn't work if one or both db are attached from an existing files.

  • Do both databases have compatibility level 90 ? You can find it in database properties/ options.

  • Mark,

    I am using vs.net 2005 server explorer to access sql server 2005. I could not see compatability level 90 in properties of the db. But the SecondDB was created using sql server 2000 and now I attached it to sql server 2005. FirstDB is created in 2005. I no longer use 2000.

    Error message doesn't say antying about compatability though.

  • You can check database compatibily level by running this query:

    select

    name,

    compatibility_level

    from master.sys.databases

    where name in ('FirstDb', 'SecondDb')

    If any of them will have compatibility level 80 (which is 2000) I recommend you to upgrade it to 2005 by runnning this:

    use master

    exec sp_dbcmptlevel SecondDb, 90

     

Viewing 5 posts - 1 through 6 (of 6 total)

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