|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 7/2/2008 7:11:53 AM
Posts: 2,
Visits: 5
|
|
|
How to create our own user defined functions please let me know its very important
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 10/11/2006 6:05:00 AM
Posts: 23,
Visits: 1
|
|
If, instead of clicking on 'Discussion forums', you move down a bit and right a bit on the Teradata.Com page, you'll see a link to 'Drivers and UDFs'.
You can pinch a pre-written UDF from there and tailor it to your own needs The one you want to write is probably already there.
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 4/28/2007 11:12:00 AM
Posts: 5,
Visits: 1
|
|
1:create a file name it 'helloworld.c',locate it in c:\temp 2:open file helloworld.c ,and copy the follow words:
#define SQL_TEXT Latin_Text #include "sqltypes_td.h" void Sayhello(VARCHAR_LATIN *result){ strcpy((char*)result,(const char*)"Hello World!"); return; }
3:save and close file helloworld.c 4:create a file name it 'helloworld.bteq',locate it in c:\temp 5:open file helloword.bteq ,and copy the follow words:
.logon yourdbc/dbc,dbc; database yourDB; replace function Sayhello() RETURNS VARCHAR(13) LANGUAGE C NO SQL EXTERNAL NAME 'CS!helloworld!c:\temp\helloworld.c!F!Sayhello' PARAMETER STYLE TD_GENERAL; .logoff
6:save and close file helloworld.bteq 7:start a command window,cd c:\temp path,and run : bteq \< helloworld.bteq 8:open Teradata SQL Assistant ,and type SELECT yourDB.Sayhello(); run it!
That's all,if you want to konw more information ,please open PDF help document and read it.
|
|
|
|