All Forums Database
prateek.saxena 12 posts Joined 08/13
24 Nov 2013
Automate my Teradata queries

Hi,
 
I have some teradata codes which I want to automate. It should be done in a way that they can execute themselves on a specific date/time of a month. 
Any help will be appreciated.
 
Regards,
Prateek

Regards, Prateek
Tags:
ulrich 816 posts Joined 09/09
24 Nov 2013

Calling the SQLs from BTEQ and schedule the BTEQ calls with a scheduler, cron etc....

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

prateek.saxena 12 posts Joined 08/13
24 Nov 2013

Hey, thank for replying. Can you please elaborate a bit?

Regards,
Prateek

M.Saeed Khurram 544 posts Joined 09/12
24 Nov 2013

Hi Parteek,
You need to put your SQL code inside Bteq as said by Ulrich. BTEQ is a Teradata sql processing tool, if you need further information about Bteq, do let me know. if you have an idea of Bteq then put your code in Bteq and use some job schedular to automate the Bteq script calls.
 
There are numerous job schedulars available in market, a list is available at
http://en.wikipedia.org/wiki/List_of_job_scheduler_software
You can also use linux feature as given at below URL
http://www.ibm.com/developerworks/opensource/library/l-job-scheduling/index.html
 

Khurram

M.Saeed Khurram 544 posts Joined 09/12
24 Nov 2013

You can read the following blog to have a basic idea of Bteq
http://www.teradatahelp.com/2010/09/introduction-to-teradata-utilities-bteq_02.html
 

Khurram

Raja_KT 1246 posts Joined 07/09
25 Nov 2013

Hi Prateek,

 

You can put your modularized codes according to the way they can execute themselves with all the logics, conditional and branching required with date/time inside a stored procedure. If it is just one one chunk of function or subject area, then you can put in one proc. If you have many procs and inter dependencies, then you can use schedulers. The best practice is to have audit log and restartability.

 

There are so many schedulers available.

 

Thanks and regards,

Raja

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

prateek.saxena 12 posts Joined 08/13
25 Nov 2013

Thanks guys, this was helpfull. :)

Regards,
Prateek

S_GALILEO 8 posts Joined 12/15
01 Feb 2016

Dear all, 
I have the same enquiry: I want to schedule my Teradata query to run every day at a given time but I am not sure I have understood the approach with BTEQ... Could you please elaborate more about this solution? An example would be more than appreciated. 
Best regards. 
 

Ckp 11 posts Joined 11/15
05 Feb 2016

Say if I need to refresh the content of my table at 1:00 AM every friday,
I will use the following btq script (which includes insert query) and unix scheduler like cron:
 
btq script example :
.logon <teradata serverName>/<UserId>,<Password>;;
drop table DB.<Table>;
create table DB.<Table>
(store_Id smallint);
.IMPORT DATA FILE=/<path to file>/in.dat
.QUIET ON
.REPEAT *
USING  storeId (smallint)
insert into DB.<Table>(store_Id) values (:storeId)
;
.logoff;
.quit;
 
 
CRON Example :
00 1 * * 5 sh  /<path to your script>/Script.sh 1>>/<path to log>/Script.log 2>&1
00- Minutes
1 -  Hour
* - Every
5 - 5th day of week (Starting from Monday so in this case Friday)

You must sign in to leave a comment.