Sybase commands

来源:互联网 发布:js list删除指定元素 编辑:程序博客网 时间:2024/05/21 21:03
sp_addlogin 'lg39304', 'citi05' --add login entry in master..syslogins with specified username and password
sp_adduser 'lg39304', 'lg39304', 'developer'  --add user entry in current database with specified username, name in db, db role
sp_dropuser 'lg39304'             --delete a specified user in current db
sp_droplogin 'lg39304'        --drop a login entry for a specified user

sp_locklogin 'lg39304',lock          --lock specified user
sp_locklogin 'lg39304', unlock    --unlock specified user

sp_helpuser                   --display all db users of current db
sp_helpuser 'lg39304'         --display the group and id info in database

sp_helprotect 'SECuser'       --display the granted access permission of the database obeject

sp_displayroles               --display roles of current user

sp_displayroles 'lg39304'     --display roles of specified user

sp_role grant, sa_role, 'lg39304'

sp_helptext
sp_constraint

********************************************************************************************

sp_who [@SOEID | "SPID"]

sp_who 'lg39304'            --display the sessions using the specified user entry
sp_who                --display all the session user entries

********************************************************************************************




sp_helpgroup 'developer'     --display all the db users who are in the specified group
sp_helpgroup            --display all the db group in current db
*********************************************************

tGroup_name                     Group_id    
----------                     -----------
batchjobs                            16390
emer_static_support                  16399
entitlementsAdmin                    16394
eqcheckPasswordGroup                 16406
financial_controls                   16391
noaccess                             16393
public                                   0
readonly                             16396
readwrite                            16405
ro_devsupp                           16398
sales                                16392
support                              16395



********************************************************************************************

select distinct name from DRMS..databaseGroups
name                                                                                                                                                                                                                                                            
----                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
developer                                                                                                                                                                                                                                                       
entitlementsAdmin       
.
.
.                                                                                                                                                                                                                                        

--***********************************************

db_name()
--***********************************************

getdate()
--***********************************************

select convert(varchar(30), getdate(), 101) now   
--convert from datetime, timestamp, smalldatetime to varchar(string)
--the format of the string can be varied[101, 110, 111, 011....]
--*************************************************************************************

sp_password [invoker's password], [user's new password], [user name]
eg: current login is:
    userName:    eqjobssso
    password:    eqjobssso99

    want to change user 'lg39304' password to 'citi009'
    cmd: sp_password 'eqjobssso99', 'citi009', 'lg39304'

eg: current login is yourself.(dev_lg39304)
    sp_password 'oldPassword', 'newPassword', 'lg39304'
--***********************************************




sp_changegroup 'entitlementsAdmin', 'lg39304'    --change the specified user to another db group
--***********************************************


      
**********************************************************************************************
**********************************************************************************************
select type from sysobjects where name = 'objectPermissions'

select type from sysobjects where name = 'databaseGroups '

select top 10 * from DRMS..objectPermissions

select * from DRMS..sysusers where name = 'eqjobs'
select suid, name, fullname, srvname, dbname from master..syslogins where name = 'eqjobs'

select * from DRMS..sysusers where name = 'lg39304'
select suid, name, fullname, srvname, dbname from master..syslogins where name = 'lg39304'

update DRMS..sysusers set suid = 800

select * from DRMS..version where application like '%SafeSQL%' and trader = 'lg39304'


Example of insert with Copying values
*********************************************************************

select * from synfCustUnd where code in ( 'STC00286','STC01169')
insert synfCustUnd select 'STC01169',undId,attribute,value, getdate() from synfCustUnd where code ='STC00286'
select * from synfCustUnd where code in ( 'STC00286','STC01169')


**********************************************************************************************
sp_helpuser;|less Userid column in the results has relation with the uid in sysusers table.

--eg:
sp_helpuser 'lg39304'
select * from sysusers where name = 'lg39304'
**********************************************************************************************

select distinct name from DRMS..databaseGroups
--this has relation with sp_changegroup, databseGroup only exists in DRMS database
原创粉丝点击