How to query scale value of decimal data types?

  • Hi all,

    I'd like to produce via query the precision and scale values of any decimal data type fields in a table. Using sys.columns I am able to get precision but not scale...any ideas on how/if I can squeeze scale in there? Code is:

    SELECT O.name AS Object_Name

    ,c.name AS column_name

    ,t.name AS type_name

    ,c.max_length

    ,c.precision

    /* I'd like to insert scale here */

    FROM sys.columns AS c

    JOIN sys.types AS t ON c.user_type_id=t.user_type_id

    JOIN sys.objects AS O ON C.object_id = O.object_id

    WHERE O.name = 'MyTableName'

    Thanks for looking!

    Brian

  • Um, add ,c.scale right after ,c.position

    (sys.columns has a scale column)

  • ha! that's what i get for not looking at a complete listing of fields available for sys.columns...must have skimmed right over it.

    it is a Monday...:hehe:

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply