Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ranjithmv
Starting Member
3 Posts |
Posted - 2009-10-12 : 09:44:29
|
Hello,Suppose, we have a table named "dbo.users". In this case, when the query "select * from users" will fetch results. i.e, no need to give "select * from dbo.users".Now, suppose, I have another user 'X'. Also, I have a table 'X.admins'. I want to fetch the contents of the table admins with the firing of the query: "select * from admins".How can this be done? Please advise.In my code which directly replicates the code in the live environment, I have queries like 'select * from admins'. But, when I restored the database present in live environment at my place, I have tables 'X.admins' and the query 'select * from admins' doesn't seem to work. This is the whole story.But, if this works in the live environment, there should be some way out. I do not have access to the live environment.Thanks,Ranjith |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2009-10-12 : 09:50:18
|
You would need to set your default schema to X to allow you to run "select * from admins". |
 |
|
ranjithmv
Starting Member
3 Posts |
Posted - 2009-10-12 : 09:59:52
|
quote: Originally posted by RickD You would need to set your default schema to X to allow you to run "select * from admins".
Thanks for the reply Rick. I am very new to SQL Server. Kindly let me know how can i set my default schema to X.Thanks,Ranjith |
 |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
|
ranjithmv
Starting Member
3 Posts |
Posted - 2009-10-28 : 02:00:55
|
quote: Originally posted by RickD Have a look here:http://msdn.microsoft.com/en-us/library/ms176060.aspx
Hello Rick,Thanks for your reply. I am using SQL Server 2000 as the database. As I am quite new to SQL, it took a while for me to find out that in SQL Server 2000, there is no concept of schemas.So, I understand that, X needs to be the default database for the logged in user. For that particular user, I set the default database as 'X'. But, still, in the SQL Analyzer, after I login with that particular user's credentials, when I fire the query:"select * from <table name>/<view name>", I am not able to retreive the table/view contents and everytime, I need to still put the queries as "select * from X.<table name>/<view name>"Appreciate your help.Thanks,Ranjith |
 |
|
|
|
|
|
|