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)
 INSERT multiple lines

Author  Topic 

obiwaugh
Starting Member

27 Posts

Posted - 2005-07-12 : 13:21:40
OK....there are 48 distinct PAYGROUPs that are defined in PS_PAYGROUP_TBL. The following script will insert one line (one accumulator) for each of the 48 paygroups. How do I insert multiple lines (multiple accumulators) for each of the paygroups?

INSERT IN PS_AL_PG_ACCUM

(PAYGROUP,ACCUM_NBR,DESCR,ACCUM_TYPE,CLEARING_OPTION)

SELECT PAYGROUP,'42','PRE-ADP HED 036 BAL','R','4TH'

FROM PS_PAYGROUP_TBL;


SAMPLE VALUES:
43 PRE-ADP YTD GARN R 4TH
44 PRE-ADP YTD EARN R 4TH


--------------------------------

I know enough to know that I don't know enough.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-07-12 : 16:39:06
You can use UNION ALL if you want to do it in one query.

INSERT IN PS_AL_PG_ACCUM(PAYGROUP,ACCUM_NBR,DESCR,ACCUM_TYPE,CLEARING_OPTION)
SELECT PAYGROUP,'42','PRE-ADP HED 036 BAL','R','4TH'
FROM PS_PAYGROUP_TBL
UNION ALL
SELECT PAYGROUP,'43','...','...','...'
FROM PS_PAYGROUP_TBL
UNION ALL
SELECT PAYGROUP,'44','...','...','...'
FROM PS_PAYGROUP_TBL

Tara
Go to Top of Page

clarkbaker1964
Constraint Violating Yak Guru

428 Posts

Posted - 2005-07-12 : 16:39:30
looks like a left outer join from Paygroup to accumulator would work if you have a table containing all the values

You can do anything at www.zombo.com
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-07-12 : 16:57:09
zombo.com annoyed me.. :(
Is that your site????


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page
   

- Advertisement -