Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Problem With Bulk insert

Author  Topic 

npk2210
Starting Member

2 Posts

Posted - 2010-04-30 : 16:10:38
Hi,

I am trying to insert data into SQL server table by using bulk insert command. Some of my data contains "single quotes" inside the character data and that record loading has terminated. Please have a look at my record below:
"2677xxx";"xxxxxx";"375305";"ST PAUL'S CATHOL";"2000031997229";"2000229";"2009-06-89";"2009-11-04"

can you please suggest me how to change my bulk insert command so that it can take "Character data containing single quotes". Your help will be highly appreciated!

Thanks!
Praveen

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-30 : 16:44:11
Try using a format file.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

npk2210
Starting Member

2 Posts

Posted - 2010-04-30 : 18:10:12
I don't have any idea how to create the format file for this issue. I would appreciate, If you can provide me more details on that.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-01 : 00:44:17
see

http://www.nigelrivett.net/SQLTsql/BCP_quoted_CSV_Format_file.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rinky30
Starting Member

5 Posts

Posted - 2010-05-03 : 13:17:55
Hi ..
I am doing a project in which i have to import data from excel sheet into sql server.. in Excel sheet i have a column name MODIFIED_ON which holds data of date and time (like 24-02-10 12:23 PM). But when i tried to import this into sql server 2005
database table in a column having datetime data type .but i get error show change this data type as varchar(20). but i have to make a report based on each data but not time included in it. how can i save MODIFIED_ON data in sql server in date format.
I want only to store date data in sql server 2005.. plz help me ....this is very urgent for me



rinkySingh
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-07 : 09:55:54
quote:
Originally posted by rinky30

Hi ..
I am doing a project in which i have to import data from excel sheet into sql server.. in Excel sheet i have a column name MODIFIED_ON which holds data of date and time (like 24-02-10 12:23 PM). But when i tried to import this into sql server 2005
database table in a column having datetime data type .but i get error show change this data type as varchar(20). but i have to make a report based on each data but not time included in it. how can i save MODIFIED_ON data in sql server in date format.
I want only to store date data in sql server 2005.. plz help me ....this is very urgent for me



rinkySingh


Let it be DATETIME datatype and use this at the start of the code
set dateformat dmy


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -