467,915 Members | 1,352 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

import textfile into 2 tables in SQL server 2000

I have a text file with hundreds of records. each line contain 1250 values seperated by a semicolon. I have created 2 tables in SQL server 2000, one with 1000 columns & the second with 250 columns. my question is how can i import this textfile in to these 2 tables.and how i ensure that first 1000 values go to first table & the rest 250 in the next from each line of the text file. can be this be done via VB.NET or ASP? I would be grateful for your help. thanks.
Nov 11 '08 #1
  • viewed: 2875
Share:
5 Replies
ck9663
Expert 2GB
Try uploading to a single table and split it once it's on the server.

-- CK
Nov 12 '08 #2
but sql server 2000 does not allow more than 1024 columns in 1 table, isnt it? isthere a way we can put 1250 columns in 1 table???
Nov 12 '08 #3
ck9663
Expert 2GB
That's a lot of columns.

Option 1:

Parse it on front-end and insert to table on the back-end

Option 2:

Upload the string as a single column (nvarchar(max))of a table, parse it in SQL Server to split into two tables.

-- CK
Nov 12 '08 #4
How do I parse it in SQL server if i import each line as a single column? Please can you provide a little with code .Many thanks.
Nov 12 '08 #5
ck9663
Expert 2GB
Option 1:

Use a lot of substrings.

Option 2:

Use cursor then tweak this code.

Option 3:

Use CTE


-- CK
Nov 12 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Doug R | last post: by
1 post views Thread by Chicagoboy27 | last post: by
1 post views Thread by joel.sjoo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.