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 |
|
asm
Posting Yak Master
140 Posts |
Posted - 2006-02-27 : 04:18:22
|
| HiI have table A : my char(6), ec (char6), j1 char(2), j2 char(2), j3 char(2), j4 char(2) ... upto j31And have another table B : Mydate smalldatetime, Ec char(6), J char(2)I want table A data should be inserted into table BTable A Data : 022006 A1 B C D E 022006 A2 F G G IInsert data in table B : 02/01/2006 A1 B02/02/2006 A1 C02/03/2006 A1 D02/04/2006 A1 E02/01/2006 A2 F02/02/2006 A2 G02/03/2006 A2 G02/04/2006 A2 IPls guide how to write insert trigger for this or Store ProcwedureThanksASM |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-02-27 : 04:26:28
|
| [code]insert into tableB (Mydate, Ec, J)select convert(datetime, right(my, 4) + left(my, 2) + '01'), ec, j1 from tableA union allselect convert(datetime, right(my, 4) + left(my, 2) + '02'), ec, j2 from tableA union allselect convert(datetime, right(my, 4) + left(my, 2) + '03'), ec, j3 from tableA union all...[/code]----------------------------------'KH' |
 |
|
|
|
|
|
|
|