select
表名 = case when a.colorder = 1 then d.name else '' end,
表說明 = case when a.colorder = 1 then isnull(f.value,'') else '' end,
字段序號 = a.colorder,
欄位名 = a.name,
字段說明 = isnull(g.value,''),
標識 = case when columnproperty( a.id,a.name,'isidentity') = 1 then '是'else '否' end,
主鍵 = case when exists(
select 1 from 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 = 1 then '是'else '否' end,
預設值 = isnull(e.text,'')
from syscolumns a
left join systypes b on a.xusertype = 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
left join sys.extended_properties f on d.id = f.major_id and f.major_id = 0 --where d.name='orderinfo' --如果只查詢指定表,加上此條件
order by
a.id,
a.colorder
C 針對SQLserver資料庫獲取資料
using system using system.collections.generic using system.linq using system.text using system.threading.tasks using system.data using system.data.sql...
python多執行緒查詢資料庫並獲取返回結果
pip install dbutils 1.3 pip install mysqlclient 2.0.1 import time import threading import mysqldb import queue from mysqldb.cursors import dictcursor ...
C 獲取所有SQL Server的資料庫例項名稱
獲取指定ip位址的資料庫所有資料庫例項名。指定的 ip 位址。登入資料庫的使用者名稱。登陸資料庫的密碼。返回包含資料例項名的列表。private arraylist getalldatabase string ip,string username,string password initial ca...