Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 problem copying database with Microsoft SQl Server

Author  Topic 

chedderslam
Posting Yak Master

223 Posts

Posted - 2007-08-15 : 23:56:39
I am trying to copy a database from the server on my web host(crystaltech) to my new local install of MS SQL Server 2005 Enterprise (trial version).



I go to Tasks>Copy Database which opens the wizard. When I get to the select database screen I get this error:



Server user 'username' is not a valid user in database '123foo'



(123foo is the first database of all those on the server)



I need have it look only at my database which I have permissions for to copy it. How do I do this?



I tried copying the tables the other way(import data) but it dropped all my identities and primary keys which is a pain to recreate. Is there a way to copy tables from one server to another without losing primary keys and identity fields?



Thanks for any help!

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2007-08-16 : 00:29:38
Hi,
You can use sp_detach_db and sp_attach_db to move database.
also see this..
http://www.aspfree.com/c/a/MS-SQL-Server/Moving-Data-from-SQL-Server-2000-to-SQL-Server-2005/
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-16 : 22:17:08
Or with backup/restore, no down time.
Go to Top of Page

MassiveOverkill
Starting Member

20 Posts

Posted - 2007-08-17 : 06:17:44
I've had this problem copying databases and had to change permissions for SQL server from network service to local service (or system) to attach the offending database. After I attached, I was able to set pemissions back to network service.
Go to Top of Page
   

- Advertisement -