Useful system stored procedures in SQL Server

后端 未结 12 836
醉话见心
醉话见心 2021-01-30 03:17

I recently discovered that I could use the sp_help to get a table definition and have been hooked onto it since then. Before my discovery, I had to open up the Obje

相关标签:
12条回答
  • 2021-01-30 04:06
    sp_catalogs 
    sp_column_privileges
    sp_column_privileges_ex
    sp_columns
    sp_columns_ex
    sp_databases
    sp_cursor
    sp_cursorclose
    sp_cursorexecute
    sp_cursorfetch
    sp_cursoroption
    sp_cursoropen
    sp_cursorprepare
    sp_cursorprepexec
    sp_cursorunprepare
    sp_execute
    sp_datatype_info
    sp_fkeys
    sp_foreignkeys
    sp_indexes
    sp_pkeys
    sp_primarykeys
    sp_prepare
    sp_prepexec
    sp_prepexecrpc
    sp_unprepare
    sp_server_info
    sp_special_columns
    sp_sproc_columns
    sp_statistics
    sp_table_privileges
    sp_table_privileges_ex
    sp_tables
    sp_tables_ex 
    

    Check This link also

    http://msdn.microsoft.com/en-us/library/ms176007.aspx

    0 讨论(0)
  • 2021-01-30 04:09

    I know it's a rather old topic, but it still has a high rank in search engines.

    These are my favorite stored procedures, I hope you find them useful too. Almost all of them can be achieved with a simple command, but these stored procedures perform some checks and validation that is useful.

    [sys].[sp_revokelogin]
    [sys].[sp_password]
    [sys].[sp_MSchangeobjectowner]
    [sys].[sp_addlogin]
    [sys].[sp_addrole]
    [sys].[sp_adduser]
    [sys].[sp_denylogin]
    [sys].[sp_droplogin]
    [sys].[sp_droprole]
    [sys].[sp_droprolemember]
    [sys].[sp_dropuser]
    
    0 讨论(0)
  • 2021-01-30 04:11

    master.dbo.xp_cmdshell

    I can't list the number of times I didn't have RDP access to a box but did have a SQL login with sufficient permissions to execute that in order to run shell commands on it.

    0 讨论(0)
  • 2021-01-30 04:11

    highlight any proc or other system object name in your query editor and hit shift-f1 to get help for that word.

    0 讨论(0)
  • 2021-01-30 04:12

    You can use sp_spaceused to determine the size of a table or the entire database. If you pass the table name, it returns the space used for that table, when called with no argument it gives the space of the database.

    0 讨论(0)
  • 2021-01-30 04:12

    Select * From sysobjects where xtype='U' order by Name

    Gives a list of all user-defined tables in a database.

    0 讨论(0)
提交回复
热议问题