SQL Default Values, Settings and Methods

  • I am working in SQL Server 2005, 9.00.3042.00. I am trying to resolve and issue with how scripts are generated and how SQL saves default integer values.

    Problem 1: In creating a table script I indicated that I wanted a default value for an integer field to be 0 (zero). Once I run the script the database engine creates the table but saves the default value as ((0)) instead of 0 or (0) which it should. Is there a setting for the table, database, instance or scripting engine that would allow me to save a default integer value as it was intended? 0 or (0)?

    Problem 2: In trying to correct the issue stated in Problem 1, I wanted to use a simple "DROP DEFAULT ". SQL now says we should use the ALTER TABLE METHOD with a DROP CONSTRAINT While this works, it is not as simple as I would have hoped, is there a simpler method?

  • I've noticed that the script generator at time puts in too many parentheses, but they're harmless. They hurt nothing, and evaluate to the same thing when all is said and done. As in, the default setting is set, it works, etc...

    Does it really matter? Or is it just one of those "this bugs me" things (also perfectly okay as an answer - I just am trying to gauge the reason)?

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • While I agree that operationally they will evaluate to the same thing, it does raise a flag when trying to compare objects in one database to the objects of another database when trying to determine the differences. I have been using the Redgate tool to compare a customers database that is at a different release level in order to generate a meaningful script to bring them up to a common or current release level. So more concisely this is not a mater of "it bugs me" but rather an issue of waste of time and resources to evaluate these delta's.

    Any help is greatly appreciated.

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

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