問題描述
我有一個 SQL 查詢,用于查詢我不需要也不想理解的龐大(例如,數百個視圖/表的名稱難以閱讀,如 CMM-CPP-FAP-ADD)數據庫.此查詢的結果需要存儲在臨時表中以提供報告.
I've a SQL query that queries an enormous (as in, hundreds of views/tables with hard-to-read names like CMM-CPP-FAP-ADD) database that I don't need nor want to understand. The result of this query needs to be stored in a staging table to feed a report.
我需要創建臨時表,但要挖掘數百個視圖/表以找到此處表示的數據類型,我想知道是否有更好的方法來構建此表.
I need to create the staging table, but with hundreds of views/tables to dig through to find the data types that are being represented here, I have to wonder if there's a better way to construct this table.
誰能建議我如何使用任何 SQL Server 2008 工具來確定 SQL 2000 數據庫中的源數據類型?
Can anyone advise how I would use any of the SQL Server 2008 tools to divine the source data types in my SQL 2000 database?
作為一般示例,我想從以下查詢中了解:
As a general example, I want to know from a query like:
SELECT Auth_First_Name, Auth_Last_Name, Auth_Favorite_Number
FROM Authors
我想知道的不是實際結果:
Instead of the actual results, I want to know that:
Auth_First_Name is char(25)
Auth_Last_Name is char(50)
Auth_Favorite_Number is int
我對約束不感興趣,我真的只想知道數據類型.
I'm not interested in constraints, I really just want to know the data types.
推薦答案
select * from information_schema.columns
可以幫助您入門.
這篇關于如何從查詢中返回 SQL 數據類型?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!