Does SQL Server 2008 support the CREATE ASSERTION syntax?

后端 未结 3 1325
伪装坚强ぢ
伪装坚强ぢ 2021-01-06 09:30

Does SQL Server 2008 support the CREATE ASSERTION syntax?

I haven\'t been able to find a straight answer on this.

相关标签:
3条回答
  • 2021-01-06 10:23

    SQL Server 2008 does not support CREATE ASSERTION.

    In fact, no current SQL products support CREATE ASSERTION properly. Sybase SQL Anywhere supports it but reportedly has problems allowing constraints to sometimes be violated. Rdb did support it when it was looked after by DEC (who apparently were influential in the early days of the SQL standards, probably the reason why CREATE ASSERTION is in the standard in the first place) but that product is no more.

    STOP PRESS: according to their documentation, HyperSQL (HSQLDB) supports assertions (though I'm left wondering why they don't shout about it on their list of features).

    0 讨论(0)
  • 2021-01-06 10:34

    No, you'd use a CHECK constraint or a TRIGGER instead, depending on complexity.

    • CHECK constraint: at the row level only
    • TRIGGER: across rows or using other tables
    0 讨论(0)
  • 2021-01-06 10:36

    No SQL Server 2008 does not support this syntax.

    0 讨论(0)
提交回复
热议问题