-1
我需要加入我的表與information_schema.columns獲取所有列的數據類型。如何加入我的表與information_schema.columns
我的sql是關注。
select stock_code,automatic,semiautomatic,manual from VehicleInfoForParts
我想加入我的VehicleInfoForParts與INFORMATION_SCHEMA.COLUMNS得到一個輸出像
Column_Name Value datatype
------------- ------- --------------
stock_code A112 varchar
automatic 1 bit
semiautomatic 0 bit
manual 1 bit
請告知。謝謝 。
您要求將列更改爲行。擁有「stock_code_datatype」和「automatic_datatype」等額外的列會更容易。這樣可以嗎? – gbn
爲什麼你想這樣做?如果您只是使用查詢引用'從Vehiclexxx選擇xxx',那麼描述結果列將爲您提供數據類型...您想實現什麼目標? – pascal
這是通過T-SQL的回答你的問題: http://stackoverflow.com/questions/7067562/t-sql-how-to-count-of-records-for-each-column – user852415