Monday, December 28, 2009

SQL Server 2008 Implementation and Maintenance (2)

SQL SERVER 2008 T-SQL Management Commands(system procedures)

1. sp_help -- show all sys proc names , object type , owner name ...
2.select name from sys.databases ; -- show all databases in one instance
3.sp_helpdb 'database name' ; -- show the information and properties of a database

4.sp_dboption ; -- settable database options == alter database clause
5. function DB_Id("database Name") -- return database ID

6. Fulltext Search
select * from sys.fulltext_languages -- show the languages which are supported
select * from sys.fulltext_document_types -- show document format supported

7. Security
select * from sys.fn_builtin_permissions(default) ; ( view all permissions which can be granted for objects)
e.g. select * from sys.fn_builtin_permissions('login') (or ' database' )

select has_perms_by_name( 'databasename' , 'database ' , 'any' ) ; -- to view if the current user is granted any permission of using database )

execute as user='someone'
go
select has_perms_by_name('databaseName' ,'database' , 'any') ;
go
( check user someone has permissions )

No comments:

Post a Comment