set quoted_identifier on goset ansi_nulls on go
--此儲存過程主要用來匯出表的相關結構create procedure get_tableinfo
(@tablename nvarchar(250)
asselect
cast(a.name as nvarchar(250)) fieldname,
cast((case when columnproperty( a.id,a.name,'isidentity')=1 then '√' else '×' end) as nvarchar(250)) fieldbs,
(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) fieldpk,
cast(b.name as nvarchar(250)) fieldtype, cast(columnproperty(a.id,a.name,'precision') as nvarchar(250)) as fieldlength,
cast((case when a.isnullable=1 then '√' else '×' end) as nvarchar(250)) fieldallownull,
cast((case when isnull(e.text,'')='' then '無' else e.text end) as nvarchar(250)) fielddefault,
cast((case when isnull(g.[value],'')='' then '無' else g.[value] end) as nvarchar(250)) as fielddescribe
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=@tablename
left join syscomments e
on a.cdefault=e.id
left join sysproperties g
on a.id=g.id and a.colid = g.smallid
order by a.id,a.colorder
goset quoted_identifier off goset ansi_nulls on go
set quoted_identifier on goset ansi_nulls on go
--此儲存過程用來匯出當前資料庫所有使用者表create procedure get_tablename
asselect o.name tablename from sysobjects o where o.type='u' and o.name<>'dtproperties'
goset quoted_identifier off goset ansi_nulls on go
asp匯出:
<%set mycommtable=server.createobject("adodb.command")with mycommtable .activeconnection=connstr.commandtext="[get_tablename]".commandtype=4.prepared = trueend withset rstable=mycommtable.executeif not rstable.eof then do while not rstable.eof%>
表名:<%=rstable(0)%>
欄位名稱
是否唯一標識
是否為主鍵
字段型別
字段長度
是否不能為空
預設值字段描述
<%=rsfield(1)%>
<%=rsfield(2)%>
<%=rsfield(3)%>
<%=rsfield(4)%>
<%=rsfield(5)%>
<%=rsfield(6)%>
<%=rsfield(7)%>
<% rsfield.movenext loopend if%>
<% rstable.movenext loopend if%>
Mysql 匯入匯出資料結構及資料
方式一 mysqldump ukevin p3306 default character set utf8 p h127.0.0.1 activity sign in user user.sql 匯出的結果包含建表指令碼及資料已insert.sql形式。匯入資料 mysql use database...
使用sql語句匯出oracle資料結構資訊
匯出資料結構文件,主要包括欄位名稱,字段型別,字段長度,是否為空,備註這幾個資訊。我們可以從user tab columns user col comments表中獲取表字段相關的資訊 select cl.column name,cl.data type,cl.data length,case wh...
資料結構 資料結構緒論
資料結構是相互間存在一種或多種特定關係的資料元素的集合。程式設計 資料結構 演算法 資料結構是一門研究非數值計算的程式設計問題中的操作物件,以及他們之間的關係和操作等相關問題的學科。資料元素是組成資料的 有一定意義的基本單位,是計算機中通常作為整體處理,也被稱為記錄。乙個資料元素可以由若干個資料項組...