Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Query Help

$
0
0

Hi,

I have one big database I want to check for all numeric data type columns I want to check what is min or max value in table. reason to check this is I want to confirm data type is correct like if for any bigint column I have max value 500 then it means datatype for this column is not correct so I will update later. 

for below query I just want to get Min and Max value for that column.

select c.TABLE_CATALOG, c.TABLE_SCHEMA, c.TABLE_NAME, c.COLUMN_NAME, c.IS_NULLABLE, c.DATA_TYPE
from INFORMATION_SCHEMA.COLUMNS c
where c.DATA_TYPE in ('int', 'bigint','money','decimal','float','numeric','real','smallint','smallmoney','tinyint')
and c.TABLE_SCHEMA not in ('dbo')
order by c.TABLE_SCHEMA


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>