CSVÎļþµ¼Èëµ½SQL Server 2005Êý¾Ý¿âÖÐ
Ê×ÏÈÓòéѯÓï¾ä£¬´ÓtblTask±íÖвéѯ³öËùÓеÄÊý¾Ý£¬È»ºó½«Æä±£´æΪcsv¸ñʽ¡£
ÔÚSQLÓï¾ä´°¿Ú£¬ÊäÈëÈçÏÂÄÚÈÝ£º
USE Keii BULK INSERT dbo.tblTask
from 'd:\tblTask.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n')£¬¾Í¿É½«ÆäÌí¼Óµ½Êý¾Ý±íÖС£
Ïà¹ØÎĵµ£º
--×÷ÓãºÊý¾Ý¿âÖÐµÄ±í±¸·Ý³ÉÎı¾
Declare @tabname varchar(200),@ip varchar(50),@user varchar(50),@password varchar(50),@sql varchar(1000),@filetxt varchar(200),@file varchar(50)
set @tabname='database.dbo.tb' --±íÃû
set @ip='127.0.0.1' --IPµØÖ·£¬±¾»úµÄ»°¾Íд127.0.0.1
set @user='sa' ......
¸ÕÅöµ½Õâ¸öÎÊÌâʱ£¬ÒÔΪÊÇÓ¦Ó÷þÎñÆ÷ºÍÊý¾Ý¿â·þÎñÆ÷ûÁ¬Í¨£¬²éÁË°ëÌìµÄÍøÂç½á¹ûÍøÉÏÒ»²é£¬¸úSQL Server 2005Óйأ¬ÄãÌ«ÑôµÄ£¡
¿ªÊ¼²Ëµ¥-SQLServer2005-ÅäÖù¤¾ß-SQL Server Configuration Manager-SQLserver2005ÍøÂçÅäÖÃ-MSSQLSERVERµÄÐÒé-Ë«»÷TCP/IPÐÒé
°ÑIP¸Ä³Éµ±Ç°Ê¹Óõģ¬µ±È»£¬¶Ë¿ÚҲҪȷ±£ ......
»Ö¸´Ä£Ê½£¨Recovery Model£©Ö¼ÔÚ¿ØÖÆÊÂÎñÈÕ־ά»¤¡£»Ö¸´Ä£Ê½ËµÃ÷Á˹¤×÷¶ªÊ§µÄ·çÏÕ£¬ÄÜ·ñ»Ö¸´µ½Ê±µã£¿
SQL ServerÊý¾Ý¿âÓÐÈýÖÖ»Ö¸´Ä£Ê½£º¼òµ¥»Ö¸´Ä£Ê½¡¢ÍêÕû»Ö¸´Ä£Ê½ºÍ´óÈÝÁ¿ÈÕÖ¾»Ö¸´Ä£Ê½¡£
Ïà¶ÔÓÚ¼òµ¥»Ö¸´Ä£Ê½¶øÑÔ£¬ÍêÕû»Ö¸´Ä£Ê½ºÍ´óÈÝÁ¿ÈÕÖ¾»Ö¸´Ä£Ê½ÌṩÁ˸üÇ¿µÄÊý¾Ý±£»¤¹¦ÄÜ¡£ÕâЩ»Ö¸´Ä£Ê½¶¼ÊÇ»ùÓÚ±¸·ÝÊÂÎñÈÕÖ ......