default databasename

General
General covers Articles, Reference documentation, FAQs, Downloads and Blogs that do not belong to a specific subject area. General-purpose Articles about everything and anything
Enthusiast

default databasename

Hi Team,

 

  I am aware that we can declare a default database name infront of any sqls in BTEQ and that database will be applicable withing BT ET

 

 eg.

              Database db1;

              select * from employee;

 The above query is same as

             select * from db1.employee;

For some reason this is not working in my new work environment, does it need any access privilages assigned by DBA 

 

Regards

Parthi

 


Accepted Solutions
Junior Contributor

Re: default databasename

If this was SQL Assistant you might close & open a new session, but not in BTEQ.

 

Can you put EXPLAIN (or SHOW) in front of the Select and check the database name?

 

I just noticed you wrote about BT/ET, you can't use DATABASE within an explicit transaction, because it's considered DDL and thus must be comitted.

Otherwise it will result in an error which you should notice ;-)

1 ACCEPTED SOLUTION
3 REPLIES
Junior Contributor

Re: default databasename

"not working" is not a very precise error description, what does it mean?

Highlighted
Enthusiast

Re: default databasename

Hi Dieter

 

The query is not performing on the table under the database its declared at front

 

Regards

Parthi

Junior Contributor

Re: default databasename

If this was SQL Assistant you might close & open a new session, but not in BTEQ.

 

Can you put EXPLAIN (or SHOW) in front of the Select and check the database name?

 

I just noticed you wrote about BT/ET, you can't use DATABASE within an explicit transaction, because it's considered DDL and thus must be comitted.

Otherwise it will result in an error which you should notice ;-)