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.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-08-31 : 10:32:00
|
Vahid writes "Hi thereI have a text file as follows:16/08/2006,14:57:11,0,00916/08/2006,08:27:44,1,00916/08/2006,14:27:52,0,01216/08/2006,08:30:24,1,012I want to insert this information into a table with following settings:emNo| Date | TimeIn1 |TimeOut1----+-----------+---------+--------009 |16/08/2006 | 08:27:44|14:57:11----+-----------+---------+--------012 |16/08/2006 | 08:30:24|14:27:52" |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-08-31 : 10:51:10
|
create table #a(d varchar(10) ,t varchar(8) ,type int ,id int)bulk insert #a from 'c:\myfile.txt' with (fieldterminator = ',')insert tbl (empno, date, timein1, timeout1)select t1.id, t1.d, t2.t, t1.tfrom #a t1join #a t2on t1.id = t2.idand t1.type = 1and t2.type = 2==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
|
|
|
|
|