How to Import data from excel to sql server 2005
-
I want to import data from excel to sql server 2005. I am using C# for this purpose. I successfully exported the data of general format to varchar. But, the problem arises while exporting the data of date type. I have used date format in excel and want to export it in sql server 2005's datetime field. The code that I have used is:- SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection); sqlBulk.DestinationTableName = "Data_Master_Inventory"; sqlBulk.ColumnMappings.Add("VendorRegistrationNo", "VendorRegistrationNo"); sqlBulk.ColumnMappings.Add("ProductCode", "ProductCode"); sqlBulk.ColumnMappings.Add("SerialNo", "SerialNo"); sqlBulk.ColumnMappings.Add("VendorProvidedSerialNo", "VendorProvidedSerialNo"); sqlBulk.ColumnMappings.Add("ModelName", "ModelName"); sqlBulk.ColumnMappings.Add("ProductCategoryCode", "ProductCategoryCode"); sqlBulk.ColumnMappings.Add("InventoryDate", "InventoryDate"); sqlBulk.WriteToServer(dReader); Please provide me necessary solution.
-
I want to import data from excel to sql server 2005. I am using C# for this purpose. I successfully exported the data of general format to varchar. But, the problem arises while exporting the data of date type. I have used date format in excel and want to export it in sql server 2005's datetime field. The code that I have used is:- SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection); sqlBulk.DestinationTableName = "Data_Master_Inventory"; sqlBulk.ColumnMappings.Add("VendorRegistrationNo", "VendorRegistrationNo"); sqlBulk.ColumnMappings.Add("ProductCode", "ProductCode"); sqlBulk.ColumnMappings.Add("SerialNo", "SerialNo"); sqlBulk.ColumnMappings.Add("VendorProvidedSerialNo", "VendorProvidedSerialNo"); sqlBulk.ColumnMappings.Add("ModelName", "ModelName"); sqlBulk.ColumnMappings.Add("ProductCategoryCode", "ProductCategoryCode"); sqlBulk.ColumnMappings.Add("InventoryDate", "InventoryDate"); sqlBulk.WriteToServer(dReader); Please provide me necessary solution.
Hi Rahul U can refer these links http://www.sqlteam.com/article/use-sqlbulkcopy-to-quickly-load-data-from-your-client-to-sql-server http://www.codeproject.com/KB/database/SqlBulkCopy.aspx http://www.codeproject.com/KB/database/TransferUsingSQLBulkCopy.aspx http://stackoverflow.com/questions/2238328/sqlbulkcopy-writetoserver-example-what-am-i-doing-wrong Thanks Ravindra
-
Hi Rahul U can refer these links http://www.sqlteam.com/article/use-sqlbulkcopy-to-quickly-load-data-from-your-client-to-sql-server http://www.codeproject.com/KB/database/SqlBulkCopy.aspx http://www.codeproject.com/KB/database/TransferUsingSQLBulkCopy.aspx http://stackoverflow.com/questions/2238328/sqlbulkcopy-writetoserver-example-what-am-i-doing-wrong Thanks Ravindra
Please use the appropriate editor buttons to make your links clickable.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Please use the appropriate editor buttons to make your links clickable.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
It's gonna be one of those kinds of days...
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
It's gonna be one of those kinds of days...
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997No change there then. ;)
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
I want to import data from excel to sql server 2005. I am using C# for this purpose. I successfully exported the data of general format to varchar. But, the problem arises while exporting the data of date type. I have used date format in excel and want to export it in sql server 2005's datetime field. The code that I have used is:- SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection); sqlBulk.DestinationTableName = "Data_Master_Inventory"; sqlBulk.ColumnMappings.Add("VendorRegistrationNo", "VendorRegistrationNo"); sqlBulk.ColumnMappings.Add("ProductCode", "ProductCode"); sqlBulk.ColumnMappings.Add("SerialNo", "SerialNo"); sqlBulk.ColumnMappings.Add("VendorProvidedSerialNo", "VendorProvidedSerialNo"); sqlBulk.ColumnMappings.Add("ModelName", "ModelName"); sqlBulk.ColumnMappings.Add("ProductCategoryCode", "ProductCategoryCode"); sqlBulk.ColumnMappings.Add("InventoryDate", "InventoryDate"); sqlBulk.WriteToServer(dReader); Please provide me necessary solution.
Always wrap your code in "pre" tag.
-
Hi Rahul U can refer these links http://www.sqlteam.com/article/use-sqlbulkcopy-to-quickly-load-data-from-your-client-to-sql-server http://www.codeproject.com/KB/database/SqlBulkCopy.aspx http://www.codeproject.com/KB/database/TransferUsingSQLBulkCopy.aspx http://stackoverflow.com/questions/2238328/sqlbulkcopy-writetoserver-example-what-am-i-doing-wrong Thanks Ravindra
hey! Please convert Url to Hyperlink! because it provide better readability and accessibility to other user.