In doing data warehousing, ETL is the most important development, and the first step in the ETL development, is extracted from the raw data to the OLTP system in the transition zone, and then the data in this transition zone conversion, final the load clean processed data into the data warehouse.
Target database is sql server, import data bcp command line. bcp manner relative to the other way, the faster is to do optimization.
The following line parameters used for the bcp command, attention to the case:
-c to char as the storage type
-w -c and the like, as the storage type nchar used only when a copy of the data set unicode character
-T trusted connection with
-S sql server name server
in import data
out export data
queryout query export data
-U username
-P password
-F which row start importing
-L until the end of which line
-f file format
-x -f used together with, the file format used to produce xml format
-t field delimiter is designated "\ t "
-R & lt specified row delimiter is" \ n "
1, open ad hoc queries
-
--修改高级参数
-
sp_configure '
show
advanced options
',1
-
go
-
--允许即席分布式查询
-
sp_configure 'Ad Hoc
Distributed Queries
',1
-
go
-
--如果配置的值不在合理范围(在最小值最大值范围内),那么可以强制覆盖
-
reconfigure with override
-
go
-
2, the export file format
File format is used to specify the format of the table, which is several fields, data types what is behind the import, export data will be used.
By exporting formatting options, you can export directly, you do not need to write our own.
With a trusted connection Online:
-
-
bcp
wc
.dbo
.calendar
format
nul
-f
c:\
calendar
.fmt
-
-c
-T
-S
pc0227gry\
mssqlserver2008
By user name, password:
-
bcp wc.dbo.calendar format nul -f c:\calendar.fmt
-
-c -Usa -Pxyz -S pc0227gry\mssqlserver2008
3, export the data file, the data can be saved to a remote server to export local files
-
bcp wc.dbo.calendar out c:\calendar.txt -f c:\calendar.fmt
-
-c -T -S PC0227GRY\MSSQLSERVER2008
4, import data
-
bcp wc.dbo.calendar in c:\calendar.txt -c -f c:\calendar.fmt
-
-Usa -Pxyz -S pc0227gry\mssqlserver2008