set default precision on decimal type?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Boot2TheHead

    set default precision on decimal type?

    This one cost me a solid half hour yesterday. I'm wondering why on
    earth the default precision for a decimal type is 18,0. Maybe I'm
    mistaken. A decimal datatype sort of implies that you'd want something
    after the decimal!

    Question is, can I set this database-wide? Like all new decimal
    datatypes have a precision of 12,6 or something like that? I haven't
    seen anything about this in the googling I have done...

  • Roy Harvey

    #2
    Re: set default precision on decimal type?

    I wouldn't expect that to be something that can be configured. As to
    the default of (18,0) vs some other value, I would never allow a
    default to be used so it doesn't strike me as a problem. It is so
    much safer, and so simple, to always specify what you need explicitly
    that I just can't get interested in the issue.

    Roy

    On 8 Dec 2006 09:34:18 -0800, "Boot2TheHe ad" <jcollum@gmail. com>
    wrote:
    >This one cost me a solid half hour yesterday. I'm wondering why on
    >earth the default precision for a decimal type is 18,0. Maybe I'm
    >mistaken. A decimal datatype sort of implies that you'd want something
    >after the decimal!
    >
    >Question is, can I set this database-wide? Like all new decimal
    >datatypes have a precision of 12,6 or something like that? I haven't
    >seen anything about this in the googling I have done...

    Comment

    • David Portas

      #3
      Re: set default precision on decimal type?

      Boot2TheHead wrote:
      This one cost me a solid half hour yesterday. I'm wondering why on
      earth the default precision for a decimal type is 18,0. Maybe I'm
      mistaken. A decimal datatype sort of implies that you'd want something
      after the decimal!
      >
      Question is, can I set this database-wide? Like all new decimal
      datatypes have a precision of 12,6 or something like that? I haven't
      seen anything about this in the googling I have done...
      I think the real question is, why would you NOT want to specify the
      precision and scale when you use DECIMAL? If it is really important to
      you NOT to specify the precision and scale then create a user-defined
      type for it (not something I would generally recommend though).

      --
      David Portas, SQL Server MVP

      Whenever possible please post enough code to reproduce your problem.
      Including CREATE TABLE and INSERT statements usually helps.
      State what version of SQL Server you are using and specify the content
      of any error messages.

      SQL Server Books Online:

      --

      Comment

      • Erland Sommarskog

        #4
        Re: set default precision on decimal type?

        Roy Harvey (roy_harvey@sne t.net) writes:
        I wouldn't expect that to be something that can be configured. As to
        the default of (18,0) vs some other value, I would never allow a
        default to be used so it doesn't strike me as a problem. It is so
        much safer, and so simple, to always specify what you need explicitly
        that I just can't get interested in the issue.
        Yes, I entirely agree. If only Sybase and/or Microsoft had agreed.
        The defaults of decimal and the character data types are do no help
        to the users, but a common source of error.


        --
        Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

        Books Online for SQL Server 2005 at

        Books Online for SQL Server 2000 at

        Comment

        Working...