在SQL Server中插入大量数据 [英] large amont of data insert in sql server
问题描述
我在excel工作表中有大量数据.我想将这些数据插入sql数据库中.
Excel工作表包含1000条记录.
我为此写代码.
我在sql中选择哪种数据类型以允许所有类型的数据,例如空格,特殊字符,数字和字符
如果您需要快速的方法,可以使用SqlBulkCopy
它的速度很快,我相信它将解决您的目的.在此处查看文章SqlBulkCopy
[ ^ ].
首先需要创建一个表格,以便导入excel数据
如果您不确定数据,则创建数据类型为VARCHAR (MAX)
的列,否则选择根据excel单元格中的值"选择适当的数据类型.
您可以使用适用于SQL Server 2000的DTS包或适用于SQL Server 2005及更高版本的SSIS导入此数据,也可以在excel文件中创建一个宏,该宏会将数据插入到表中,也可以在c#中执行此操作. br/>
您可以引用 SSIS
DTS
请参阅以下讨论: ^ ]
i have large amont of data in excel sheet .i want to insert that data in sql database.
excel sheet contain 1000 records .
i write code for it.
what data type i choose in sql to allow all type of data like spaces,special character ,numbers, and characters
If you need a fast way, you can useSqlBulkCopy
its fast and I believe it will solve your purpose. Check out the article forSqlBulkCopy
over here[^].
First thing you need to create a table for the excel data to import
If you are not sure about the data then create columns with data type asVARCHAR(MAX)
or else the choose the appropriate data types as per the Value in the excel cell.
you can import this data using DTS Package for SQL Server 2000 or SSIS for SQL Server 2005 and above or else you can create a macro in excel file that will insert the data to the table and also you can do this in c# also..
You can refer SSIS
DTS
please see this discussion: import MS Excel to datatable[^]
这篇关于在SQL Server中插入大量数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!