Table migrating from SQL Server to Oracle

Background: sql server database table structure has a time field, the format 2012/12/1 15:40:03

1. Using BCP from SQL Server 2012 to export the table to xls.

- Simple export table Exec  master..xp_cmdshell  ' BCP db_oa.dbo.T_User_list OUT c: \ a.xls -c -T ' - "-T" trusted connection Exec  master..xp_cmdshell  ' BCP db_oa.dbo.T_User_list OUT C: \ a.txt -C -Usa -Pxxxxx ' - filter export table Exec  master..xp_cmdshell  ' BCP "SELECT * from db_oa.dbo.t_user_list Top. 3" the queryout C: \ a.txt -C -T ' - - simple import table Exec  master..xp_cmdshell  ' BCP db_oa.dbo.T_User_list_2 in C: \ a.txt -C -T ' Exec  master..xp_cmdshell  ' BCP db_oa.dbo.T_User_list_2 in C: \ A.txt -c -T -E
    





' - add "-E" Enable identity_insert on    

http://www.cnblogs.com/qanholas/archive/2011/07/05/2098616.html


2. The processing time field

  The display processing time field in Excel

Select entire right column --- --- --- Format Cells write e / m --- custom type / d h: mm: ss or YYYY / M / D H: MM: SS OK

 Export to csv file processing is complete


3. Use SQL Developer to import CSV

Set the date in the format where the format shall be set to  YYYY / MM / DD HH24: MI  : SS


January 2017 13 updates

How to enable SQL Server xp_cmdshell components

http://www.cnblogs.com/atree/p/SQL_SERVER_xp_cmdshell.html

1, open SQL statement. [Recommend this method because you can use any version of SQL SERVER in. ]
Through Query Analyzer, select Master database, then execute the following SQL elements:
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go

Results of the:

  Configuration option 'show advanced options' to change from 0 to 1. Run the RECONFIGURE statement to install.
  Configuration option 'xp_cmdshell' been changed from 0 to 1. Run the RECONFIGURE statement to install.

To close simply "sp_configure 'xp_cmdshell', 1" to "sp_configure 'xp_cmdshell', 0" to.

2, BCP is not an internal or external command, operable program of

http://blog.sina.com.cn/s/blog_6d357c8a0101imoi.html

sql 2008 r2 output sql script file error. bcp is not an internal or external command, operable program, as long as the C: \ Program Files \ Microsoft SQL Server \ 100 \ Tools \ Binn added to PATH in the family to stay, that is to find the path bcp command.




Guess you like

Origin blog.csdn.net/Chen_cs/article/details/52460199