Wrong scripting of constraints that use [] inside their name
Brian Donahue
Posts: 6,590 Bronze 1
Hi Janko,
I suppose we could 'escape' brackets the same way we 'escape'
single-quotes by adding an additional one of the same characters.
Are you sure that you want to use brackets like this? There must be
other SQL tools that are not going to work if you do this...
Regards,
Brian Donahue
Red Gate Technical Support
"Janko Lupsa" <jnai7@hotmail.com> wrote in message
news:Rahr5i$ZEHA.2428@server53...
> Problem:
> when a check constraint fails the SQL error message doesn't say much
except
> the name of check constraint.
>
> Solution:
> So I figured I could write a short message in its name, for example:
> CK_Table_1_[_Negative_numbers_not_allowed_for_quantity_]
> CK=check constraint; Table=table name; 1=ordinal number of CK on that
table;
> [_Negative_numbers_not_allowed_for_quantity_]=error message inside square
> brackets seemed like a good optical delimiting.
>
> Sync Problem:
> Enterprise Manager works with no problem. SQL Compare script dies with
> syntax error, because there is one more ] missing at the end of CK name
(it
> takes two ] to quote one. Just try what script EM makes and what SQL
> Compare.
>
> Best regards, Janko Lupsa
>
>
I suppose we could 'escape' brackets the same way we 'escape'
single-quotes by adding an additional one of the same characters.
Are you sure that you want to use brackets like this? There must be
other SQL tools that are not going to work if you do this...
Regards,
Brian Donahue
Red Gate Technical Support
"Janko Lupsa" <jnai7@hotmail.com> wrote in message
news:Rahr5i$ZEHA.2428@server53...
> Problem:
> when a check constraint fails the SQL error message doesn't say much
except
> the name of check constraint.
>
> Solution:
> So I figured I could write a short message in its name, for example:
> CK_Table_1_[_Negative_numbers_not_allowed_for_quantity_]
> CK=check constraint; Table=table name; 1=ordinal number of CK on that
table;
> [_Negative_numbers_not_allowed_for_quantity_]=error message inside square
> brackets seemed like a good optical delimiting.
>
> Sync Problem:
> Enterprise Manager works with no problem. SQL Compare script dies with
> syntax error, because there is one more ] missing at the end of CK name
(it
> takes two ] to quote one. Just try what script EM makes and what SQL
> Compare.
>
> Best regards, Janko Lupsa
>
>
This discussion has been closed.