Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select "owner".table 1

Status
Not open for further replies.

ofsouto

Programmer
Apr 29, 2000
185
BR
I am new on DB2 and after to create tables and populate them I tried to execute a query like this: Select * from table_name.
An error showed up and I had to change the query to :
Select * from "owner".table_name. Is there any way to omit "owner" and the query runs well?
What must I do to run well the 1st query?
Thanks in advance.
 
First do,
SET CURRENT SCHEMA=
and then your queries ..

HTH

Sathyaram
 
Hello ofsouto,

If the schema name is different than the authority id with which you connect you will get this effect. Since DB2 uses the id's from the operating system, you can circumvent this by using a new authorisation id which is exactly the same as the schema name (schema = owner) T. Blom
Information analyst
tbl@shimano-eu.com
 
I do that: SET CURRENT SCHEMA=owner
but the error persists

DBA2191E SQL execution error

com.ibm.db.DataException: [IBM][CLI Driver][DB2/NT] SQL0204N "OWNER.TABLE_NAME" is an indefined name. SQLSTATE=42704

Thanks.
 
Try something along the lines of

db2 connect to owner user xxxxx using yyyyyy

where xxxxx is your user and yyyyy is your users password

before you run your query.

Cheers
Greg
 
Greg,

Shouldn't that be :

connect to <database> user xxxxx using yyyyyyy

where <database> is the database or alias you connect to...

T. Blom
Information analyst
tbl@shimano-eu.com
 
T.Blom,

it certainly should. Unfortunately I've not got DB2 in front of me so was going off memory, hence I wrote &quot;along the lines of&quot;.

Luckily it was close enough for you to recognise what I was saying and correct me. Thank you.

Ofsouto how's it going? Do you have a solution yet?

Cheers
Greg

 
Now, I know what happened.
I used SQL-Server tool to migrate tables/data from SQL to DB2 and this tool create the &quot;OWNER&quot; schema when the correct schema is OWNER. When I create a table on OWNER schema the 1st query (Select * from table_name) runs well.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top