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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 SQL Server 2005 Export/import .SQL

Author  Topic 

aleroot
Starting Member

1 Post

Posted - 2010-02-14 : 10:41:06
I'm new of sql server express, i ever used mysql.

with mysql i can dump a database with mysqldump in a text file .SQL and i can import a this dump file directly from mysql ...

Can i do the same thing with SQLCMD or OSQL in the SQL Server command line ?

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-02-14 : 10:51:07
bcp would be ok. Also worth exporting structure to reference referential integrity

Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-14 : 11:25:22
SQL 2008 can create a script for all tables etc., and also all data
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-14 : 11:26:23
P.S. If you just want to move a database from A to B (without editing it on the way with a text editor) then just use BACKUP and RESTORE.
Go to Top of Page

haryiips
Starting Member

2 Posts

Posted - 2010-02-15 : 07:53:50
Pretty simple steps to follow :

Install SQL server management studio 2005/08
Once configured, connect by providing authetication windows or sql

Important steps to backup data : example adventurework database

1. expand database available
2. right click on advanturework dbase
3. select option "tasks"
4. Select "backup"
5. In new pop up window- name the backup file (as you like)
6. At the bottom, assign the path for file to be stored on hard disk (Ex : c:/....../desktop)
7. Backup created successfully.

For script : notice on script icon at top of pop up window

click on script to generate on new sql window

For help : A sample script for AdvantureWork database is provided here


BACKUP DATABASE [AdventureWorks] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\AdventureWorks.bak', DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\trial up back' WITH NOFORMAT, NOINIT, NAME = N'AdventureWorks-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO


"For-warned is For-armed"
Go to Top of Page

haryiips
Starting Member

2 Posts

Posted - 2010-02-15 : 07:57:02
Restore :

On the footstep of backing up data - as shown above

You can restore database choosing restore option in place of backup


A sample script for backup : Sample AdventureWork


RESTORE DATABASE [AdventureWorks] FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\AdventureWorks.bak', DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\trial up back' WITH FILE = 1, NOUNLOAD, STATS = 10
GO
Go to Top of Page
   

- Advertisement -