顯示table欄位資料

2021-04-20 01:08:05 字數 1269 閱讀 4752

select

(case when a.colorder=1 then d.name else '' end)表名,

a.colorder 字段序號,

a.name 欄位名,

(case when columnproperty( a.id,a.name,'isidentity')=1 then '√'else '' end) 標識,

(case when (select count(*)

from sysobjects

where (name in

(select name

from sysindexes

where (id = a.id) and (indid in

(select indid

from sysindexkeys

where (id = a.id) and (colid in

(select colid

from syscolumns

where (id = a.id) and (name = a.name))))))) and

(xtype = 'pk'))>0 then '√' else '' end) 主鍵,

b.name 型別,

a.length 占用位元組數,

columnproperty(a.id,a.name,'precision') as 長度,

isnull(columnproperty(a.id,a.name,'scale'),0) as 小數字數,

(case when a.isnullable=1 then '√'else '' end) 允許空,

isnull(e.text,'') 預設值,

isnull(g.[value],'') as 字段說明

from  syscolumns  a left join systypes b

on  a.xtype=b.xusertype

inner join sysobjects d

on a.id=d.id  and  d.xtype='u' and  d.name<>'dtproperties'

left join syscomments e

on a.cdefault=e.id

left join sys.extended_properties g

on a.id=g.major_id and a.colid = g.major_id

where d.name='fa_sno'

order by a.id,a.colorder

BLOB欄位資料讀取

因為開發的時候公司的專案,所以只能說明不能截圖了,在這裡請大家諒解。blob這個字段,首先是存大資料的,本人倒是不建議在資料庫中存入那麼大的資料,影響伺服器效能。而且如果表沒有採用分布儲存,沒有考慮維護,一段時間就會很大,本人一點見解,表大小超過1g的容量時候,明顯影響資料讀取速度。這個扯的有點遠了...

table迴圈顯示資料

一直都在找乙個關於table迴圈顯示資料的應用,可找來找去,最終還是自己把它給做出來了,為了記得更深刻,現將它記錄下來 前台 page language c autoeventwireup true codebehind webtable.aspx.cs inherits doctype html ...

修改字段資料型別

我們假設相關表中沒有資料,使用sql語句修改字段型別的相關操作,以下就是具體方案的描述。如果表中沒有資料 直接這樣就可以了 alter table 表名 modify 欄位名 型別 eg alter table student id number 4 如果原表中存在data那麼方法就大不相同了,請看...