Select type of columns that come in a SELECT

2

Hello, my question is the following:

I have a Select in SQLServer of two tables with inner join, they return a set of 5 columns. I would like to know how to list the type of these columns.

I know that I can show the type of columns with SP_Columns , but it only shows me if the last parameter is a table or view.

My select is this:

SELECT *
FROM Produtos p
INNER JOIN Marca m
ON p.prodcodigo=m.prodcodigo
    
asked by anonymous 17.06.2014 / 14:44

1 answer

1

You can use the SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS metadata table, but you will not be able to relate to your table. There are two alternatives to this.

At first, it will be necessary to make multiple queries, until the desired result is obtained. In the second, you create a column in your database, saving the data type as value.

    
18.06.2014 / 04:08