日期:2014-05-18  浏览次数:20836 次

SQL Server 2005 BCP工具导入时间项不准确
SQL code

EXEC master..xp_cmdshell 'BCP esky_test.dbo.Table_esky2 in D:\Bruce\Server\Server\UDPServer\Currency.dat -e D:\Bruce\Server\Server\UDPServer\err.txt -x -c -T\'



Currency.dat文件中的内容(这个一个文本文件)[b][/b]
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.504 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.504
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.505 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.505
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.507 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.507
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.509 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.509
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.510 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.510
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.512 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.512
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.513 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.513
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.515 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.515
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.516 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.516
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.518 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.518
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.519 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.519
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.521 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.521


写入到SQL Server中的数据
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.503 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.503
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.507 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.507
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.507 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.507
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.510 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.510
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.510 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.510
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.513 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.513
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.513 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.513
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.517 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.517
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.517 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.517
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.517 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.517
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.520 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.520
865439000116060 31.28985 120.60122 0 KM/H 2012-03-12 21:20:55.520 171.0 8 1111 1111 1111 0x1 1111 127.0.0.1:16621 1 2012-03-12 21:19:55.520



请注意数据库中日期时间的那两项和Currency.dat文件中的差别:文件中2012-03-12 21:20:55.504写入数据库后变为