I was wondering if it is possible to write a query that returns a field only if that field contains a certain data type.
So for example, I could want to return all fields with data type VARCHAR from a search, or data type BIGINT. Not just search for fields that contain numbers or letters.
Here is an example of my psuedo code: (I know it's not very impressive):
select *
from dbo.REP_ALIAS ra
where ra.TRADE_REP [= data type integer] --integer is just an example
Is there some way to do this for all data types, not just integer.
Also: I am using T-SQL with MS SQL Server 2008 R2.