Search code examples
databasesybasesap-iq

set user's default database/schema in Sybase IQ


i googled it and find nothing. Short story, i created a user and granted to a table in my SyBase. but when i try

select * from table1

it didn't work. Error show Permission denied: you don't have permission to select from "table1" and i try add dbname before table name like this and it works :

select * from dbname.table1

i suspect that user default database is something else so i want to set dbname to his default database. Anyone know how to do this?


Solution

  • This has nothing to do with database names (or login policies). Given your comment that "dbname" is actually the user who owns the table, here's what's happening.

    When you specify a table name without an owner, the server has to figure out which table you mean. It first looks for a table that you own with that name. If it doesn't find one, it looks for tables owned by any groups that you are a member of. I suspect that one of these groups has a table named "table1" that you do not have permission to select from.

    When you specify a table name with an owner, the server knows exactly which table to use. Since you do have permission to select from that table, you get the results you want.