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)
 Conditional importing using BCP with SQL version 6.5

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-13 : 09:46:36
Steve writes "OS: Windows NT4 SP4
SQL: 6.5 SP5


Is there any way I can automatically import data with a varying number of columns per row into a SQL 6.5 table


Input ^ delimited data files....

1^a^b^c^d^e^f
2^a^b^c^
3^a^b^c^d

Results required...

Id Col1 Col2 Col3 Col4 Col5 Col6
1 a b c d e f
2 a b c null null null
3 a b c d null null


i.e. row one may have 7 columns and row two may have 4. Can BCP(?) 'pad' out the missing 3 columns in row one with null values so it can be imported with a format file?

Steve."

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2001-12-16 : 18:53:51
Hi Steve

Have a look at this post, and the linked thread. I think you are best off doing some pre-processing on your data file.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11449



Damian
Go to Top of Page
   

- Advertisement -