Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Runnig multiple queries through MS Excel uusing ODBC DSN - forum topic by ABSDBA

$
0
0

 Hello,
I need to run the below queries using a single Connection Wizard, but it gies error :
Only an ET or null statement is legal after a DDL Statement.
Please advice...it's urgent!!!
Query:
 
CREATE VOLATILE TABLE profile_info
(
ProfileName VARCHAR(128)
)ON COMMIT PRESERVE ROWS;
INS profile_info VALUES('PROF_BO_USERS');
INS profile_info VALUES('PROF_DBA');
INS profile_info VALUES('PROF_LOADCDR_USERS');
INS profile_info VALUES('PROF_LOADNCDR_USERS');
INS profile_info VALUES('PROF_LOW_BUSINESSUSERS');
INS profile_info VALUES('PROF_POWER_BUSINESSUSERS');
INS profile_info VALUES('PROF_SAS_USERS');
CREATE VOLATILE TABLE hour_info
(
"Hour" INTEGER
)ON COMMIT PRESERVE ROWS;
INS hour_info VALUES(0);INS hour_info VALUES(1);INS hour_info VALUES(2);INS hour_info VALUES(3);
INS hour_info VALUES(4);INS hour_info VALUES(5);INS hour_info VALUES(6);INS hour_info VALUES(7);
INS hour_info VALUES(8);INS hour_info VALUES(9);INS hour_info VALUES(10);INS hour_info VALUES(11);
INS hour_info VALUES(12);INS hour_info VALUES(13);INS hour_info VALUES(14);INS hour_info VALUES(15);
INS hour_info VALUES(16);INS hour_info VALUES(17);INS hour_info VALUES(18);INS hour_info VALUES(19);
INS hour_info VALUES(20);INS hour_info VALUES(21);INS hour_info VALUES(22);INS hour_info VALUES(23);
LOCKING ROW FOR ACCESS
SEL m.ProfileName
,m."Hour"
,COALESCE(d.CPU,0) CPU
FROM
(SEL ProfileName
,"Hour"
FROM profile_info,hour_info
) m
LEFT OUTER JOIN
(
SELECT
p.ProfileNameI ProfileName
,EXTRACT(HOUR FROM a.starttime) "Hour"
,SUM(a.AmpCpuTime) CPU
FROM dbc.DBQLogTbl a
,dbc.profiles p
WHERE a.ProfileId = p.ProfileId
AND CAST(a.starttime AS DATE) = DATE - 1
AND p.ProfileNameI IN ('PROF_BO_USERS','PROF_DBA','PROF_LOADCDR_USERS',
'PROF_LOADNCDR_USERS','PROF_LOW_BUSINESSUSERS','PROF_POWER_BUSINESSUSERS',
'PROF_SAS_USERS')
GROUP BY 1,2) d
ON m.ProfileName = d.ProfileName
AND m."Hour" = d."Hour"
ORDER BY 1,2;

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>