By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,940 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,940 IT Pros & Developers. It's quick & easy.

The most efficient way to import such a text data from a sql server table

P: 22
Greetings,

Now I have a SQL server table T1 which has one column: Col, and one row. The data looks like this:

a1,a2,a3,b1,b2,b3,c1,c2,c3,...,x1,x2,x3

Now I wish to load it to a new table T2. T2 has three columns: col1, col2,col3, and has many rows. It should look like this:

Table T2

--------------
col1 col2 col3
--------------
a1 a2 a3
b1 b2 b3
c1 c2 c3

.............
x1 x2 x3

I think of export table T1 to disk, and then bulk insert it in to table T2. But there should be other ways using T-SQL (I am not using SSIS).

Thanks,

CUQ
Oct 29 '12 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,430
Use a union all and select it into your new table. I don't know what your data looks like but it sounds unnormalized and you should think about fixing that.
Oct 29 '12 #2

Post your reply

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