SQLSERVER查詢當前資料中的所有表
--切換資料庫
use c2
go
--查詢當前資料庫表名
select [name] from sysObjects where xtype='U' and [name] <> 'dtproperties' order by[name]
--查詢當前資料庫所有使用者檢視
Select [name] From sysObjects Where xtype='V' And [name]<>'syssegments' And [name]<>'sysconstraints' Order By [name]
--獲得指定表中所有的列和型別
Select
c.name As '列名',
t.name As '列型別'
From syscolumns c, systypes t, sysobjects o
Where c.xtype = t.xusertype
And c.id = o.id
And o.name='base_dict' --指定表名
Order By c.colorder
--獲取當前資料庫指定列名在那些表中 [ 在修改資料庫中的某個欄位,但這個欄位又有關聯其他表,用這種方式一幕瞭然就能看出哪張表用了我這個欄位 ]
Select
m.name AS '表名',
c.name As '列名',
t.name As '列型別'
From syscolumns c, systypes t, sysobjects o , ( select [name] from sysObjects where xtype='U' and [name] <> 'dtproperties' ) m
Where c.xtype = t.xusertype
And c.id = o.id
And o.name =m.name
And c.name='product_id' --指定列名
Order By m.name
--獲取當前資料庫所有表列名和表型別
Select
m.name AS '表名',
c.name As '列名',
t.name As '列型別'
From syscolumns c, systypes t, sysobjects o , ( select [name] from sysObjects where xtype='U' and [name] <> 'dtproperties' ) m
Where c.xtype = t.xusertype
And c.id = o.id
And o.name =m.name
Order By m.name
use c2
go
--查詢當前資料庫表名
select [name] from sysObjects where xtype='U' and [name] <> 'dtproperties' order by[name]
--查詢當前資料庫所有使用者檢視
Select [name] From sysObjects Where xtype='V' And [name]<>'syssegments' And [name]<>'sysconstraints' Order By [name]
--獲得指定表中所有的列和型別
Select
c.name As '列名',
t.name As '列型別'
From syscolumns c, systypes t, sysobjects o
Where c.xtype = t.xusertype
And c.id = o.id
And o.name='base_dict' --指定表名
Order By c.colorder
--獲取當前資料庫指定列名在那些表中 [ 在修改資料庫中的某個欄位,但這個欄位又有關聯其他表,用這種方式一幕瞭然就能看出哪張表用了我這個欄位 ]
Select
m.name AS '表名',
c.name As '列名',
t.name As '列型別'
From syscolumns c, systypes t, sysobjects o , ( select [name] from sysObjects where xtype='U' and [name] <> 'dtproperties' ) m
Where c.xtype = t.xusertype
And c.id = o.id
And o.name =m.name
And c.name='product_id' --指定列名
Order By m.name
--獲取當前資料庫所有表列名和表型別
Select
m.name AS '表名',
c.name As '列名',
t.name As '列型別'
From syscolumns c, systypes t, sysobjects o , ( select [name] from sysObjects where xtype='U' and [name] <> 'dtproperties' ) m
Where c.xtype = t.xusertype
And c.id = o.id
And o.name =m.name
Order By m.name
相關文章
- sql 查詢當前使用者所有表的容量SQL
- Oracle查詢當前使用者和當前使用者下的所有表Oracle
- MySQL查詢當前資料庫中所有記錄不為空的表MySql資料庫
- 查詢當前網段的所有在用IP
- sql查詢當前使用者所有表、欄位及相關注釋資訊SQL
- oracle 查詢所有表的表名Oracle
- 查詢當前SQL Server的版本SQLServer
- 查詢表中所有列名
- Oracle如何查詢當前LockOracle
- oracle 查詢所有表的行數Oracle
- 查詢當前ubuntu版本號的命令Ubuntu
- sqlserver查詢資料的所有表名和行數SQLServer
- Oracle查詢當前會話的sidOracle會話
- Oracle 查詢當前會話標識Oracle會話
- 使用者查詢當前session IDSession
- MySQL 查詢所有表中的記錄數MySql
- 查詢所有資料字典的SQLSQL
- 查詢前50%的資料
- 查詢當前正在執行的job的情況
- 查詢時間從前7天到當前時間
- Oracle查詢資料庫中所有表和分割槽表的記錄數Oracle資料庫
- 查詢 SQL SERVER 所有表記錄數SQLServer
- 根據欄位名查詢所有表
- 取得EBS 當前form介面查詢LOV的源sqlORMSQL
- Sqlserver查詢出所有表的大小使用情況SQLServer
- ORACLE刪除當前使用者下所有的表的方法Oracle
- Laravel查詢 日期比當前時間早一個月的資料Laravel
- 查詢當前資料庫存在某個字串的儲存過程資料庫字串儲存過程
- 查詢mysql某張表中的所有資料(欄位)型別MySql型別
- 查詢前90%的資料值
- Oracle中用sql查詢獲取資料庫的所有觸發器,所有儲存過程,所有檢視,所有表...OracleSQL資料庫觸發器儲存過程
- ORACLE查詢所有表空間使用情況Oracle
- 查詢當前執行的sql及相關內容SQL
- 查詢當前正在執行的SQL語句並KILLSQL
- sqlserver查詢一個庫所有表的記錄數SQLServer
- 【原創】用外部表的方式查詢當天資料庫alert日誌檔案中當天所有的ora-錯誤資訊資料庫
- SQLServer查詢所有資料庫大小SQLServer資料庫
- 查詢emp表上的所有約束的詳細資訊