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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 To insert duplicates

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-06-25 : 15:09:20
emp_details

emp_id emp_name comp_id dept entry_date Comments


258 Jihn 13006044 SQR 2/27/2000 SQ-entry
303 Greg 12972360 FRT 10/30/1999 fr-completed
449 Troy 12973061 HGT 11/3/1999 HG-pending
453 Aby 12973541 MHT 11/7/1999 MH-Not decided



I need to make insert to this table where each of these 4 entries should be duplicated 5 times and with different dept and comments
dept - DFT,TRY,IUE,RTB,HJK
corressponding comments - to be checked,wait,re-entry,trying,processing


please help me with this query

X002548
Not Just a Number

15586 Posts

Posted - 2004-06-25 : 15:15:26
Isn't that really 25?



Brett

8-)
Go to Top of Page

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2004-06-25 : 15:19:36
CROSS JOIN

select a.emp_id, a.emp_name, a.comp_id, a.entry_date, b.dept, b.comments
from mytable a CROSS JOIN
(select 'dft'as 'dept', 'to be checked' as 'comments'
union
select 'try', 'wait'
union
select 'iue', 're-entry'
union
select 'rtb', 'trying'
union
select 'hjk', 'processing'
) b

...not sure about the dept-comment association but something like this.
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-06-29 : 14:46:58
Thanks....Done
Go to Top of Page
   

- Advertisement -