September 17, 2015 at 9:09 am
Hello,
I am not a SQL expert by any means but I have question. I am trying to insert into a row in SQL 2012 a default value for one column and then the results of some select count(*) queries into the other columns.
Here is my example:
insert into x64_hourly_activity (Hour,Ingests,Restores,Proxies, Tape_Onsite, Tape_Offsite)
select (select count(*) from x64_Ingest_metrics_temp where datepart(hh, date2) = 00 and datepart(mi, date2) <= 59),
(select count(*) from x64_restore_metrics_all_temp where datepart(hh, date2) = 00 and datepart(mi, date2) <= 59),
(select count(*) from x64_proxy_metrics_raw_temp where datepart(hh, date2) = 00 and datepart(mi, date2) <= 59),
(select count(*) from x64_tape_metrics_temp where datepart(hh, date2) = 00 and datepart(mi, date2) <= 59 and Storage_Loc = 'XYZ'),
(select count(*) from x64_tape_metrics_temp where datepart(hh, date2) = 00 and datepart(mi, date2) <= 59 and Storage_loc = 'JKL')
What is the statement I use to insert 12AM as a value for Hour?
I hope this makes sense.
Thanks in advance to whoever can point me in the right direction.
Ruben
September 18, 2015 at 6:38 am
Think I figured this out.....
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply