17,242 reputation
33263
bio website in.another.dimension
location Athens, Greece
age 46
visits member for 3 years, 6 months
seen 23 mins ago

Interests: math, programming and games, not necessarily in that order.


15m
comment Adding time to an event that runs on a weekly basis
adding + INTERVAL 11 HOUR in the starting datetime.
44m
comment Users Characteristics
Or even worse a row with result: 1, User1, Smoker, Religion ?
47m
comment Users Characteristics
No foreign keys, no unique constraints. What prevents more rows with results: 1, User1, Buddhist, Religion and 1, User1, Non-smoker, Smoker? And being both a Christian and a Budhist may be an option but both smoker an non-smoker, I think not.
2h
comment table check constraint, greater than > not accepting
Yes, my bad. It should be Reference_ID IS NOT NULL instead of Reference_ID >= 0
2h
comment table check constraint, greater than > not accepting
Edit the question and add the whole CREATE TABLE statement and the INSERT which is failing, along with the the exact error you get.
2h
comment table check constraint, greater than > not accepting
You probably want something like CHECK (Passenger_Type IN ('Baby','Youth','Child') AND Reference_ID >= 0 OR Passenger_Type = 'Adult'). There are several problems with your check constraint. It is missing the END and you can't have boolean expressions (i.e. Reference_ID >=0) as a result.
4h
revised Locking and spatial data
deleted 10 characters in body; edited title
20h
reviewed Reopen Technical documentation for Replication
22h
revised Type of an id field that references another id field
added 4 characters in body
22h
answered Type of an id field that references another id field
23h
revised Check Constraint with Case Statement
added 23 characters in body
1d
comment deleting a table referenced by many foreign keys
Do the FKs reference this column that you want changed? Does the table have data? If yes, don't you care about them? And what should happen to the relevant data in other tables (that reference this table)?
1d
revised Rolling count of total transactions over time
edited tags; edited tags
1d
awarded  Enlightened
1d
awarded  Nice Answer
1d
comment Speed up a MySQL BETWEEN query
dateToFind BETWEEN dateFrom AND dateTo is a condition.
1d
awarded  Nice Answer
1d
comment Outer Apply vs Left Join Performance
I suggest you don't delete the question. You can even answer it, with your new query. But you'll probably get some more answers, with details about what should be preferred, how the sql-server works internally and how to approach such problems..
1d
comment Check Constraint with Case Statement
What error do you get exactly? The constraint seems valid syntactically. And it is: fiddle. Either you have some other code that produces the error or you have already data in the table that violate the constraint (and the error is that the constraint cannot be added.)
1d
comment Check Constraint with Case Statement
Check constraints cannot alter the values. They can restrict the insert or updating of rows if the constraint is violated.