Unanswered: How to determine data types from an SQL query?
I am using SQL Server 2008 and the sqlcmd client. I would like to obtain the system data types (e.g., char, varchar, int, float, etc.) associated with each column returned by arbitrary queries. These "arbitrary queries" may include joins and otherwise dynamically generated columns.
No can do without submitting additional queries. Look at joining sys.columns and sys.types. You can determine the table the columns belong to by joining to sys.tables, or using OBJECT_NAME(columns.object_id).