1. sa 로 접속하신다음에..

2. 새로운 사용자를 하나 만듭니다.

 1>sp_addlogin aaa,aaa123

 2>go

3. 사용자가 만든 디비로 들어가셔서

 1>sp_changedbowner aaa

 2>go

 

이렇게 하시면 다음에는 aaa라는 user로 사용가능합니다.

수고하세요..^^

 

 

Changing User Information

Additional system procedures allow you to change any of the user information added with the commands discussed earlier in this chapter. For example, sp_modifylogin and sp_password change default databases and passwords for SQL Server users.

The system procedures described in Table 4-3 change aspects of users' logins and database usage.

Table 4-3: : System Procedures for Changing User Information
System Procedure Task Executed By Where
sp_password Change another user's password

Change own password
SSO

user
any database
sp_changegroup Change group assignment of a user SA, DBO user database
sp_modifylogin Change a login account's default database, default language, or full name

Change own default database, default language, or full name
SA


user
any database
sp_trustlogin Change a login account`s sensitivity labels, add labels to an account, remove labels from an account SSO any database

Changing Passwords: sp_password

Your site may choose to use the password expiration interval configuration variable to establish a password expiration interval to force all SQL Server users to change their passwords on a regular basis. (See "password expiration interval" for information.) Even if you do not use password expiration interval , for security reasons it is important that users change their passwords from time to time.

The column pwdate in syslogins records the date of the last password change. This query selects all login names whose passwords have not been changed since January 30th, 1994:

 select name, pwdate  
from syslogins
where pwdate < "Jan 30 1994"

A user can change passwords at any time with the system procedure sp_password. The System Security Officer can use this system procedure to change any other user's password. The syntax is:

 sp_password   caller_passwd, new_passwd   [,   login_name  ] 
  • caller_passwd is the password of the login account that is currently executing sp_password . When you are changing your own password, this is your old password. When a System Security Officer uses sp_password to change another user's password, caller_passwd is the password of the System Security Officer.

     

  • new_passwd is the new password for the user executing sp_password , or for the user indicated by login_name . The password must be at least six bytes long, and can be any printable letters, numerals, or symbols. A password must be enclosed in quotation marks if:
    • It includes characters other than A-Z, a-z, 0-9, _, #, valid single- or multi-byte alphabetic characters, or accented alphabetic characters

       

    • It begins with 0-9

       

     

  • See "Choosing a Password" for guidelines on selecting a password.

     

  • login_name may only be used by a System Security Officer to change another user's password.

     

For example, a user can change her password from "3blindmice" to "2mediumhot" with this command:

 sp_password "3blindmice", "2mediumhot" 

These passwords are enclosed in quotes because they begin with numerals.

In the following example, the System Security Officer whose password is "2tomato" changes Victoria's password to "sesame1":

 sp_password "2tomato", sesame1, victoria 

Null Passwords

You may not assign a null password. However, when SQL Server is installed, the default "sa" account has a null password. The following example changes a null password to a valid one:

 sp_password null, "16tons" 

Note that "null" is not enclosed in quotes.

Permissions Required

All users can use sp_password to change their own passwords. only a System Security Officer can use it to change another user's password.

Changing User Defaults with sp_modifylogin

The sp_modifylogin system procedure allows a user to change his or her default database, default language, or full name at any time. The System Administrator can use sp_modifylogin to change these for any user. The syntax is:

 sp_modifylogin   login_name, option, value   
  • login_name is the name of the user whose account you are modifying.

     

  • option specifies the option that you are changing. The options are listed in Table 4-4 , and are described in more detail in the sections following.

    Table 4-4: : Options for sp_modifylogin
    Option Definition
    defdb The "home" database to which the user is connected when he or she logs in.
    deflanguage The official name of the user's default language, as stored in master..syslanguages .
    fullname The user's full name.

     

  • value is the new value for the specified option.

     

After you execute sp_modifylogin to change the default database, the user is connected to the new default database the next time he or she logs in. However, sp_modifylogin does not automatically give the user access to the database. Unless the Database Owner has set up access with sp_adduser , sp_addalias , or with a guest user mechanism, the user is connected to master even after his or her default database has been changed.

Examples

This example changes the default database for "anna" to pubs2 :

 sp_modifylogin anna, defdb, pubs2 

This example changes the default language for "claire" to French:

 sp_modifylogin claire, deflanguage, french 

This example changes the full name for "clemens" to "Samuel Clemens."

 sp_modifylogin clemens, fullname, "Samuel Clemens" 

Changing a User's Group Membership: sp_changegroup

The System Administrator can use the system procedure sp_changegroup to change an existing user's group affiliation. At any one time, each user can be a member of only one group other than "public," of which all users are always members. When new users are added to the database, they are assigned to the group "public" as well as any group specified with the sp_adduser procedure.

Before you execute sp_changegroup :

  • The group must exist. (Use sp_addgroup to create a group.)

     

  • The user must have access to the current database (must be listed in sysusers ).

     

The syntax for sp_changegroup is:

 sp_changegroup   grpname, name_in_db   

For example, here's how you'd change Jim from his current group to the group "manage":

 sp_changegroup manage, jim 

To remove a user from a group without assigning the user to another group, you must change the group affiliation to "public":

 sp_changegroup "public", jim 

The name "public" must be in quotes because it is a reserved word. All users are always members of "public." This command reduces Jim's group affiliation to "public" only.

When a user changes from one group to another, the user loses all permissions that he or she had as a result of belonging to the old group. That user gains the permissions that have been granted to the new group.

The assignment of users into groups can be changed at any time.

'컴퓨터관련' 카테고리의 다른 글

안시 표준 쿼리, 1968년...펌  (0) 2011.01.12
엑셀 날짜 시간 자동입력...펌  (0) 2011.01.11
sybase db비번 변경...  (0) 2011.01.09
mysql db 비번 변경...펌  (0) 2011.01.09
select distinct, group by having count...펌  (0) 2011.01.08

+ Recent posts