| Archives of the TeradataForumMessage Posted: Wed, 15 Sep 2004 @ 22:40:26 GMT
 
 
  
| Subj: |  | Re: Create Stored Procedure from inside a BTEQ Script |  |  |  | From: |  | Dennis Calkins |  
 Hi, Here is an example I put together for someone a while back where it is all embeeded inside a single BTEQ script. It makes use of liberal calls to 
     .os
 which means go run this from the command line.  Also it was written from UNIX.  I guess you could do the same thing on windows provided
the command were DOS-ized. 
     .logon mytdp/myuser1,myuser1
     create user  myuser as perm = 1e6, password=myuser;
     grant create procedure on myuser to myuser with grant option;
     grant all on myuser to myuser with grant option;
     .logon myuser,myuser;
     .os  rm /tmp/my.spl
     .os  echo "CREATE PROCEDURE my_procedure (mystring VARCHAR(300))"
     >> /tmp/my.spl.os  echo " BEGIN" >> /tmp/my.spl
     .os  echo "      CALL DBC.SysExecSQL(:mystring) ; " >> /tmp/my.spl
     .os  echo " END;" >> /tmp/my.spl
     .compile file = /tmp/my.spl
     call my_procedure('create database george as perm = 1e4');
 
 |