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 |
mahajanakhil1985
Yak Posting Veteran
71 Posts |
Posted - 2010-08-19 : 13:33:21
|
Hello. 1. When I use the command 'select current_user', it shows 'dbo' as default user. Which is this user? Is it login name or user under <database_name>->security->users?2. When working in Management Studio, I want that all SQL statements are executed for a particular schema (not 'dbo'). I It means that I want to change the default schema for that database. How can I accomplish it?I have searched it a lot on google but could not find exactly what I want. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-19 : 13:56:04
|
1.from BOLCURRENT_USER returns the name of the current security context. If CURRENT_USER is executed after a call to EXECUTE AS switches context, CURRENT_USER will return the name of the impersonated context. If a Windows principal accessed the database by way of membership in a group, the name of the Windows principal will be returned instead of the name of the group.2. you assign default schema to user not a database. you need to use ALTER USER statement for that seehttp://msdn.microsoft.com/en-us/library/ms176060.aspx------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
mahajanakhil1985
Yak Posting Veteran
71 Posts |
Posted - 2010-08-23 : 06:31:51
|
I have used the following statements to allow my user to execute SQL statements under qps schema but still when I execute statement after log and login, it shows dbo as my current user:use qpsalter user qps with login=qpsalter login qps with password= 'abc@123'alter login qps with default_database=qpsalter user qps WITH DEFAULT_SCHEMA=qpsDo I need to do anything else? |
|
|
mahajanakhil1985
Yak Posting Veteran
71 Posts |
Posted - 2010-08-27 : 07:31:00
|
any updates to this? |
|
|
|
|
|