January 30, 2009 at 8:13 am
Hi there,
I am trying to get scale & precision of all the fields with decimal/numeric datatype.
Is there any script to do so....?
I tried using sys.systypes but it is showing me max scale & precision possible.. i.e. 38. But I am looking for precision/scale used in that field.
thank you,
January 30, 2009 at 8:19 am
I got it.
using sys.columns... precision & scale... it can be determined.
select
object_name(c.object_id) "Table Name"
,c.name "Column Name"
,s.name "Column Type"
,c.precision
,c.scale
from sys.columns c
join sys.systypes s
on (s.xtype = c.system_type_id)
where
object_name(c.object_id) in
(select name from sys.tables where name not like 'sysdiagrams')
and s.[name] in ('decimal','numeric')
January 30, 2009 at 8:20 am
this seems to work for me
select table_name, column_name, numeric_precision, numeric_scale
from INFORMATION_SCHEMA.COLUMNS
where table_name = table_name
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy