生成實體檔案 需要用到的SQL 語句

2021-09-08 02:24:11 字數 2567 閱讀 9522

--

-------sql server ---------------

----- 獲取使用者表

select id,name from sysobjects where xtype='u

'and name<>

'dtproperties

'order

by name

---- 獲取使用者儲存過程

select id,name from sysobjects where xtype='p

'and name<>

'dtproperties

'order

by name

--- 獲取使用者檢視

select id,name from sysobjects where xtype='v

'and name<>

'dtproperties

'order

by name

declare

@tbname

nvarchar(60)

goset

@tbname='

tbname'--

---獲取使用者表具體結構

select

表明 =

case

when a.colorder=

1then d.name else''

end,

表說明 =

case

when a.colorder=

1then

isnull(f.value, '

') else''

end,

字段序號 = a.colorder,

欄位名 = a.name,

標示 =

case

when

columnproperty( a.id,a.name, '

isidentity

')=1

then'√

'else''

end,

主鍵 =

case

when

exists(select

1from sysobjects where xtype=

'pk

'and parent_obj=a.id and name in (

select name from sysindexes where indid in(

select indid from sysindexkeys where id = a.id and colid=a.colid))) then'√

'else''

end,

型別 = b.name,

占用位元陣列 = a.length,

長度 =

columnproperty(a.id,a.name, '

precision

'),小數字數 =

isnull(columnproperty(a.id,a.name, '

scale

'),0),

允許空 =

case

when a.isnullable=

1then'√

'else''

end,

預設值 =

isnull(e.text, '

'),字段說明 =

isnull(g.[

value

], '

')from

syscolumns a

left

join

systypes b

ona.xusertype=b.xusertype

inner

join

sysobjects d

ona.id=d.id and d.xtype='u

'and d.name <>

'dtproperties

'left

join

syscomments e

ona.cdefault=e.id

left

join

sys.extended_properties g

ona.id=g.major_id and a.colid=g.minor_id

left

join

sys.extended_properties f

ond.id=f.major_id and f.minor_id=

0where d.name=

@tbname

order

bya.id,a.colorder

生成實體檔案 需要用到的SQL 語句

sql server 獲取使用者表 select id,name from sysobjects where xtype u and name dtproperties order by name 獲取使用者儲存過程 select id,name from sysobjects where xtyp...

需要用到的Linux命令

1.預設級別轉換為3 文字模式 ln sf lib systemd system multi user.target etc systemd system default.target 2.或者預設級別轉換為5 圖形模式 ln sf lib systemd system graphical.targ...

python需要用到的筆記

總結 pycharm常用的一些命令 建立django專案的 django admin startproject 專案名稱 讓模型類轉變為資料表,生成遷移檔案 python manage.py makemigrations 執行遷移生成表 python manage.py migrate git命令 ...