--1:獲取當前資料庫中的所有用戶表

select Name from sysobjects where xtype='u' and status>=0

--2:獲取某一個表的所有欄位

select name from syscolumns where id=object_id('表名')

--3:查看與某一個表相關的視圖、存儲過程、函數

select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%表名%'

--4:查看當前資料庫中所有存儲過程

select name as 存儲過程名稱 from sysobjects where xtype='P'

--5:查詢用戶創建的所有資料庫

select * from master..sysdatabases D where sid not in(select sid from master..syslogins where name='sa')

或者

select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01

--6:查詢某一個表的欄位和資料類型

select column_name,data_type from information_schema.columns
where table_name = '
表名'

相关文章:

  • 2022-12-23
  • 2021-11-25
  • 2021-12-24
  • 2022-12-23
  • 2022-02-13
  • 2021-07-09
  • 2022-02-17
  • 2022-12-23
猜你喜欢
  • 2021-08-31
  • 2022-12-23
  • 2022-02-05
  • 2021-09-03
  • 2022-12-23
  • 2021-07-20
  • 2021-08-28
相关资源
相似解决方案