系統的一些表用途

2021-06-01 07:32:44 字數 2968 閱讀 6759

--檢視表的屬性

select * from sysobjects where [name] = 'section'

--用法

if exists ( select * from sysobjects where [name] = 'section' and xtype='u' )

drop table table1

go create table1 ( )

--獲取所有使用者表

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

--檢視表的字段

select * from syscolumns c where c.id=object_id('section')

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

--檢視使用者

select * from sysusers where status<>0

--檢視誰引用了bbs_hits表(包括檢視、儲存過程、函式)

select distinct object_name(d.id) as 'program',

o.xtype

from sysdepends d inner join sysobjects o on d.id=o.id

where object_name(depid)='bbs_hits'

--檢視與某乙個表相關的檢視、儲存過程、函式

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

--檢視當前資料庫中所有儲存過程

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

--查詢某乙個表的字段和資料型別

select column_name,data_type from information_schema.columns

where table_name = '表名'

[n].[標題]:

select * from tablename order by customername

其中xtype分別對應:

c = check 約束

d = 預設值或 default 約束

f = foreign key 約束

fn = 標量函式

if = 內嵌表函式

k = primary key 或 unique 約束

l = 日誌

p = 儲存過程

--檢視表的屬性

select * from sysobjects where [name] = 'section'

--用法

if exists ( select * from sysobjects where [name] = 'section' and xtype='u' )

drop table table1

go create table1 ( )

--獲取所有使用者表

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

--檢視表的字段

select * from syscolumns c where c.id=object_id('section')

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

--檢視使用者

select * from sysusers where status<>0

--檢視誰引用了bbs_hits表(包括檢視、儲存過程、函式)

select distinct object_name(d.id) as 'program',

o.xtype

from sysdepends d inner join sysobjects o on d.id=o.id

where object_name(depid)='bbs_hits'

--檢視與某乙個表相關的檢視、儲存過程、函式

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

--檢視當前資料庫中所有儲存過程

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

--查詢某乙個表的字段和資料型別

select column_name,data_type from information_schema.columns

where table_name = '表名'

[n].[標題]:

select * from tablename order by customername

其中xtype分別對應:

c = check 約束

d = 預設值或 default 約束

f = foreign key 約束

fn = 標量函式

if = 內嵌表函式

k = primary key 或 unique 約束

l = 日誌

p = 儲存過程

r = 規則

rf = 複製篩選儲存過程

s = 系統表

tf = 表函式

tr = 觸發器

u = 使用者表

v = 檢視

x = 擴充套件儲存過程

r = 規則

rf = 複製篩選儲存過程

s = 系統表

tf = 表函式

tr = 觸發器

u = 使用者表

v = 檢視

x = 擴充套件儲存過程

UITextView 的一些用途

uitextview textview uitextview alloc initwithframe cgrectmake 50,100,275,100 textview.backgroundcolor uicolor graycolor nsstring str 編輯文字時沒那麼重要,但如果要18...

typedef的一些用途

用途一 定義一種型別的別名,而不只是簡單的巨集替換。可以用作同時宣告指標型的多個物件。比如 char pa,pb 這多數不符合我們的意圖,它只宣告了乙個指向字元變數的指標,和乙個字元變數 以下則可行 typedef char pchar pchar pa,pb 這種用法很有用,特別是char pa,...

oralce一些系統表

檢視使用者下所有的表 select from user tables 檢視使用者下所有的表的列屬性 select from user tab columns where table name upper table name 檢視某錶的建立時間 select object name,created ...