Question : SQL syntax for how to insert multiple values from multiple views into table columns on the same row

insert into GPRA_Totals(ActiveClinicalPopDen)
select count (*) from vw_GPRA_ActiveClinicalPopulationDenominator

This statement works for entering a value in the first column but I have about 20 more in the table. I plan to run each count for each separate view in SSIS and then have it insert into each column. I want to run it at night because some of these take awhile to run so each on will run after the other succeeds. The problem is I need them all to go on the same row for each day I run them. I don't have a primary key or row count id or anything like that at this point, it's more of a temp table in essence so any ideas on how t to make this work would be great. Thanks

Answer : SQL syntax for how to insert multiple values from multiple views into table columns on the same row

You can use GETDATE(), but the reason why I suggested the system variable is because if this package takes a long time to run, and it runs through the night on into the next day, your dates might get thrown off.

My solution is still very automatted.  It is just passing in the datetime that the SSIS package started running.  I use this so that you have one consistant datetime value to work with.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
--Task 1
INSERT INTO GPRA_Totals (DateLoaded) VALUES (?)
 
--Task 2
UPDATE GPRA_Totals
  SET ActiveClinicalPopDen = (SELECT COUNT(*) FROM vw_GPRA_ActiveClinicalPopulationDenominator)
  WHERE DateLoaded = ?
 
--Task 3
UPDATE GPRA_Totals
  SET Total2 = (SELECT COUNT(*) FROM vw_GPRA_whatever)
  WHERE DateLoaded = ?
 
...
Open in New Window Select All
Random Solutions  
 
programming4us programming4us