Although some simple databases can start off completely empty, in most cases you need to preload tables by using external data from flat files or other databases. Likewise, once your database has been in use for a while, you’ll probably need to transfer data to Microsoft Excel or some other program. SQL Server 2005 Express has several methods that you can use to import or export data. The primary tools that ship with SQL Server Express are the bcp utility, the T-SQL BULK INSERT statement, and the T-SQL OPENROWSET statement. Bcp is a command-line tool that can import and export files. Using bcp is somewhat archaic and can be cumbersome. But once you set up a transfer, it can be easily incorporated into your Windows command shell scripts so that you can rerun the data transfer.

BULK INSERT is a T-SQL statement that you can run from a T-SQL script by using SQL Server Management Studio Express (SSMSE) and Query Editor or the command-line sqlcmd program. As its name implies, you can use the BULK INSERT statement only to import data to SQL Server. OPENROWSET is another T-SQL statement that you can run from Query Editor or the sqlcmd utility. The OPENROWSET statement can query and update data from OLE DB data sources. OPENROWSET is best suited to transferring data to and from other databases.

However, for most SQL Server Express users, the best tool for the job is the SQL Server Import and Export Wizard (DTSWizard.exe), which is hidden deep in the C:\Program Files\Microsoft SQL Server\90\DTS\Binn\ directory. Unlike the other command-oriented import and export tools, the SQL Server Import and Export Wizard is a fully graphical tool. The SQL Server Import and Export Wizard was added to SQL Server Express as part of Service Pack 1 (SP1), and it can work flat files as well as .NET, OLE DB, and ODBC data sources.

The SQL Server Import and Export Wizard provides powerful and flexible data transfer and transformation capabilities. But when you use it with SQL Server Express, the wizard is best suited to ad-hoc data transfers rather than transfers that need to be run regularly. This caveat exists because although the SQL Server Import and Export Wizard can save its transfer requests as SQL Server Integration Services (SSIS) packages, the wizard doesn’t include the full SSIS functionality. Still, if you’re looking for a powerful, easy-to-use data import and export utility, dig into the C:\Program Files\Microsoft SQL Server\90\DTS\Binn\ directory and give the SQL Server Import and Export Wizard a try.

End of Article




You must log on before posting a comment.

If you don't have a username & password, please register now.

Reader Comments

I don't find a C:\Program Files\Microsoft SQL Server\90\DTS\Binn\ folder or DTSwizard.exe anywhere ...? I updated to SQL serverExpress SP2 a few weeks back - is there something beyond the normal install required for the DTSwizard ?

thanks, Dan S.

dsomerv

Article Rating 3 out of 5

It's good to know the basic differences between all the import/export functionality in SSE, but I generally look for more in-depth articles to learn advanced skills. Besides, I thought this article was about SQL Server 2005 Express...but there is no DTS folder in my directory path. I installed the Advanced Services edition (and unchecked the "Hide advanced config" box) along with the Toolkit, so I'm not sure where else I could find this. Thanks!

maryR

Article Rating 3 out of 5

DTS is not part of SQL 2005, and doing away with it realy irks me.

taersious

Article Rating 2 out of 5

It is good to know that they included the DTSWizard in the sp1. I was wondering why they would leave that out.

Kyt81Jbm

Article Rating 3 out of 5

DTS (Integration Services) In Sql server Express can be save in sql server format like data transformation services in sql server 2000? or only is a ETL Tool? how i can access from sql server Express itself? with stored procedures ?

rickstone.mx@gmail.com

Article Rating 4 out of 5

I found it and it was able to use it successfully to import an IIS log file -- very useful. Is this perhaps a SP2 feature?

Thanks for pointing this out Michael.

compdev

Article Rating 5 out of 5

less useful

tatis

Article Rating 2 out of 5

Rubbish

Pierre.Jamali@misys.com

Article Rating 1 out of 5

Crap dude, I thought you were going to explain BCP. Had to register to find out, that, Physche!!! You talk about SQL Server Import and Export Wizard instead. OI! You got me this time.

anderkb101

Article Rating 1 out of 5

The Bulk Copy Program (BCP) is a command-line utility that ships with Microsoft SQL Server. With BCP, you can import and export large amounts of data in and out of SQL Server databases quickly and easily. For example:To export the authors table out of pubs and import it into pubs2 on stevenw server for user sa and empty password, you can do next: bcp pubs.dbo.authors out c: emppubauthors.bcp –n –S stevenw –U sa –P bcp pubs2.dbo.authors in c: emppubauthors.bcp –n –S stevenw –U sa –P Sincerely, LukCAD

LukCAD

Article Rating 3 out of 5

No good

RynoB

Article Rating 1 out of 5

No good

RynoB

Article Rating 1 out of 5

 
 

ADS BY GOOGLE