Fix Default Constraint Naming

  • Comments posted to this topic are about the item Fix Default Constraint Naming

  • Michael,

    I get

    Warning! The maximum key length is 900 bytes. The index 'PK_AliasRules' has maximum length of 1025 bytes. For some combination of large values, the insert/update operation will fail.

    for your script at http://files.soendergaard.info/Install_spFixColumnDefaultNaming_V2005-2008.sql. Running the 2008 studio on a SQl2005 db.

    It worked perfectly, BTW - awesome piece of code - I'll need to tweak it to do the same for PKs, FKs, IX and UKs ...

    Great standards technique,

    Doug

  • Don't worry about the warning it only matters if you alias rows are larger than 900 bytes. And if you are not using any aliases it doesn't matter at all

    Actually you don't need to tweak spFixColumnDefaultNaming for handling PK, FK, IX and UK. My other stored procedures are scheduled for publication the next couple of days. But if you can't wait. just check my site. http://sql.soendergaard.info

  • Awesome - now these are the kind of articles we need.

    Doug

  • BTW for all future readers.

    I have noticed two errors in the publication.

    1. I am showing the source code for spFixColumnCheckNaming instead of spFixColumnDefaultNaming. However they are 99% identical in structure and feature. If you want to look at the right source code, check for install script, that is still correct.

    2. A copy / paste error have occurred in the result output for example 2. Please ignore the first line

  • I am using AliasRules table. I need clarity regarding this warning:

    "Warning! The maximum key length is 900 bytes. The index 'PK_AliasRules' has maximum length of 1025 bytes. For some combination of large values, the insert/update operation will fail."

    How can you tell if your key length will approach 900 bytes? What combination of large values will fail?

  • It means that if all columns making up the primary key is larger than 900 bytes combined, you would be able to add that to the alias table. In practice it shouldn't have an affect, unless your schema, table and column names are very long

  • Thanks for the script.

Viewing 8 posts - 1 through 7 (of 7 total)

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