Databasename as parameter in BTEQ script

General
Enthusiast

Databasename as parameter in BTEQ script

Hi All

I am going through few BTEQ scripts and can see DATABASENAME in unusual format.

My guess it is some parameter however not sure about it.

Example:

SELECT ... from Stage.W#GLOBAL.ABCDEF 

SELECT ... FROM %DATABASENAME%

What is %SOMENAME% in BTEQ script ? Few instances I could also see '%ABCD.2%' . What does this mean ?

 

TIA

Nitin

3 REPLIES

Re: Databasename as parameter in BTEQ script

Hi Raj,

 

The first thing when we make a bteq script we used to define any parameter as #PARAMETER#.

EX: SELECT * FROM TEST_DB.PROVIDER_TBL

After paramterized the values

SELECT * FROM #TDDatabase#.#SrcTbl#

 

On SELECT ... FROM %DATABASENAME% it will not work.

When we use like then we use to do that '%DATABASENAME%' but in quotes.

But while selecting any value from a database you can not use as  %DATABASENAME% this will give you error.

Enthusiast

Re: Databasename as parameter in BTEQ script

Hi Nipun

Thanks for quick reply.

However how were you passing parameters to bteq script ?

I mean how #DATABASENAME# shall be replaced by DB_STAGE in BTEQ while execution ?

 

I used to work with shell scripts and used shell variables to generate BTEQ dynamically with actual values replacing parameters. However haven't used parameters inside BTEQ before.

 

Cheers

Raj

Teradata Employee

Re: Databasename as parameter in BTEQ script

Raj,

 

Same answer. There is no internal BTEQ parameter replacement, you must do it programatically like you did with shell scripts

 

Dave