473,382 Members | 1,204 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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

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
1 1989
Rabbit
12,516 Expert Mod 8TB
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

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

Similar topics

4
by: news | last post by:
Our production database in an exported textfil runs about 60 MB. Compressed that's about 9 MB. I'm trying to import the export into another machine running FC3 and mySQL 11.18, and it appears as...
1
by: D Mat | last post by:
Hi, I'm trying to get MS Access 2000 to automatically import a series of (~200) flat text, tab delimited, data files into a single Access table, with consistent fields and rows. The files have...
4
by: orange | last post by:
I've got a database in .txt file similar to this: BookName;Author;Year;ReviewedBy;Rating;Pages Nemesis;Isaac Asimov;1989;13,31,24;good;110 Sense & Sensibility;Jane Austen;1970;45,32;great;120...
3
by: Dave G | last post by:
I will shortly be receiving data in the form of a text file, like this: id: 123456 first name: Fred surname: Bloggs age: 26 and so on, for about 60 fields. Each line ends with a carriage...
2
by: KingoftheKings | last post by:
I'm new here. I want a help with VB codes that will import text or excel files from a specified directory in to an existing or new Access table. I have written some codes, but when I click the...
4
by: Max2006 | last post by:
Hi, We are developing a SQL server based asp.net application. As part of requirement we should allow users import/export some relational data through web user interface. We are investigation...
2
by: cynderborg | last post by:
My database is a tool to write an extensive report. I need the ability to pull a canned response from one table into another table if the user wants to adopt the text. I have the form opened that...
8
by: =?Utf-8?B?Ym9iYnk=?= | last post by:
Could you please help me in this project. I have aTab delemeted file. It has 20 columns and some data. I have to import this data into SQL Server. I am using sql express edition. I am using...
5
priyan
by: priyan | last post by:
hi all, I am newbie to sql server 2005. I want to import a bulk data from an excel file to the table..........pls suggest me a solution on how to do this................pls reply me as...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.