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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 bcp and quoted identifiers

Author  Topic 

ccrespo
Yak Posting Veteran

59 Posts

Posted - 2007-09-07 : 11:28:00
Im using bcp to import the follwing:

"14908","Lynch","Patricia","11844","9146826419","Levat MD","2007-09-07 08:40:50","SUCC MACHINE","1","55"
"14911","Spero","Linda","11851","9146826419","Deangelis MD","2007-09-07 08:41:54","SUCC MACHINE","1","33"
"14914","Cass","Linda","12606","9146826419","Levat MD","2007-09-07 08:40:49","SUCC MACHINE","1","55"
"14917","Deutsch","Herbert","12890","9146826419","Deangelis MD","2007-09-07 08:40:48","SUCC MACHINE","1","33"
"14920","Giorgi","Nicholas","10929","9146826419","Levat MD","2007-09-07 08:40:48","SUCC MACHINE","1","55"
"14923","Batty","Michelle","11283","9146826419","Deangelis MD","2007-09-07 08:40:49","SUCC MACHINE","1","33"
"14926","Kantor","Edward","14205","9146826419","Gottfried MD","2007-09-07 08:40:48","SUCC MACHINE","1","15"
"14929","Goldstein","Linda","15004","9146826419","Park MD, Susan","2007-09-07 08:40:49","SUCC MACHINE","1","2439"
"14932","Gusmano","Joseph","15355","9146826419","Deangelis MD","2007-09-07 08:40:50","SUCC MACHINE","1","33"
"16156","Conner","Sandra","13190","9146826419","Calleo Cross","2007-09-07 08:41:51","SUCC PERSON","1","35"
"14905","Recall Test Three","Cate","257976","9146826571","Newman MD","2007-09-07 08:42:37","SUCC PERSON","1","61"
"16084","Recall Test 1","Alfred","218191","9141111111","Kraftowitz MD","2007-09-07 08:45:40","LINE BUSY","2","52"
"16324","Recall Test 2","Benji","257974","9149826571","Newman MD","2007-09-07 08:41:38","SUCC PERSON","1","61"


If there is a comma within the "", like "Park MD, Susan", its still separating the fields.

exec master.dbo.xp_cmdshell 'bcp WMGRecallSystem..TeleminderIn in \\wmg-lab-server\recalldata\teleminderin\uploadtest.txt -q -f\\wmg-lab-server\recalldata\teleminderin\test.fmt -C1252 -U sa -P sa -t@'


here is my format file:

7.0
10
1 SQLCHAR 0 100 "," 1 OutreachId
2 SQLCHAR 0 100 "," 2 Last
3 SQLCHAR 0 100 "," 3 First
4 SQLCHAR 0 100 "," 4 PatientId
5 SQLCHAR 0 100 "," 5 Phone1
6 SQLCHAR 0 100 "," 6 Doctor
7 SQLCHAR 0 100 "," 7 CallDate
8 SQLCHAR 0 100 "," 8 CallResult
9 SQLCHAR 0 100 "," 9 AttemptCount
10 SQLCHAR 0 100 "\r\n" 10 DoctorId


Is there any way to get it to accept fields with quoted identifiers?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-09-07 : 12:33:11
You might need to use a different delimiter...

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -