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
 SQL Server Development (2000)
 Insert field containing tab-delimited data into a table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-01 : 00:20:33
Chris writes "I have a field that contains a string that is tab-delimited. I want to create a temp table and insert the data into distinct fields in the temp table.

EX.
RawData Table contains 3 rows with the following data stored in a varchar field:

123212'tab'Joe Cool'tab'243 Main Street'tab'Anywhere'tab'TN'tab'

334323'tab'Betty Joe'tab'24 Elm Street'tab'Anywhere'tab'TN'tab'

534534'tab'John Doe'tab'221 Oak Street'tab'Anywhere'tab'TN'tab'

temp table:
IdAdrs
Name
Adrs
City
State

I want to be able to select the field for the 3 rows from the rawdata table into the temp table (similar to what the bcp utility does) using a T-SQL script. I am considering changing the field to be space delimited and using the substring command. Do you have any suggestions?

Thanks"
   

- Advertisement -