The <name> query cannot be used in a CHECK constraint clause. (Error 3801)

This error occurs when using the CREATE TABLE or ALTER TABLE ALTER COLUMN syntax and using the CHECK constraint clause. The error occurs when a CHECK constraint attempts to reference an attached/linked table or a view/procedure/stored query.