How to determine the datatypes of the results of a SQL?
You might use few quick SQL statements to view result column type, by using temp table.
Temp tables is a little better then a view, as they are connection-local scope and will be cleared once disconnect.
All you need is inject few keyword as follow
SELECT
TOP 0 -- to speed up without access data
your,original,columns
INTO #T -- temp table magic
FROM originalTablesJoins
Order by anything
exec tempdb.sys.sp_columns #T
drop table #T
or;
SELECT TOP 0 *
INTO #T
FROM (
select your,original,columns from originalTablesJoins -- remove order by if any
) x
exec tempdb.sys.sp_columns #T
drop table #T
Note: inspired by View schema of resultset in SQL Server Management Studio
If you're using SQL Server, metadata from various tables is available in the information_schema
table. For instance, to get column metadata for table Foo, issue this query:
SELECT * FROM information_schema.columns WHERE table_name = 'Foo'
You can run the query with SET FMTONLY ON, but that might not help you to easily determine the data types returned, since you're working in management studio only. If it was me, I think I'd create a view temporarily with the same body as the stored procedure (you may have to declare variables for any parameters). You can then look at the columns returned by the view with the INFORMATION_SCHEMA queries already discussed.