MSSQL中如何用SQL語句查詢字段型別

2022-02-15 10:54:30 字數 391 閱讀 1174

最佳答案

這個肯定得從系統表中查詢了。select a.name as [column],b.name as typefrom syscolumns a,systypes bwhere a.id=object_id('表名') and a.xtype=b.xtype把「表名」替換成你要檢視字段型別的表名,比如你要檢視sysobjects表的各欄位型別那麼就是select a.name as [column],b.name as typefrom syscolumns a,systypes bwhere a.id=object_id('sysobjects') and a.xtype=b.xtype另外可以通過儲存過程exec sp_help 表名來檢視表各字段的資訊,其中就包括字段型別。

通過 為知筆記 發布

mysql語句查 mysql中SQL語句查

show tables 檢視或顯示所有表名 show databases 檢視或顯示所有資料庫名 desc 表名 檢視表結構 select form 表名 查詢表中所有欄位的值 select from 表名 order by 指定欄位名 desc 按照指定字段降序查詢表中資料資訊 select fr...

如何用SQL語句進行模糊查詢?

like條件一般用在指定搜尋某字段的時候,通過 萬用字元的作用實現模糊查詢功能,萬用字元可以在前面也可以在後面或前後都有。搜尋以mian開頭 select from teble where title like mian 搜尋以mian結束 select from teble where title...

如何用SQL語句查詢Excel資料?

q 如何用sql語句查詢excel資料?a 下列語句可在sql server中查詢excel工作表中的資料。excel 2007和2010版本 select from opendatasource microsoft.ace.oledb.12.0 data source c book1.xlsx u...