Last post Jul 13, 2018 02:05 PM by PatriceSc
Jul 13, 2018 08:50 AM|sripadasatpathy|LINK
0 Sasank Like this
Please suggest me how to do
Jul 13, 2018 09:21 AM|rajesh93180|LINK
Show me your code once.
Jul 13, 2018 02:00 PM|mudassarkhan|LINK
Kindly explain your logic in detail
Jul 13, 2018 02:05 PM|PatriceSc|LINK
Not enough details. It should do exactly what you told ie either you provide and value and it uses that value or nothing at all and it could use a default value you defined.
See what is the exact SQL statement you are running and why do you think it doesn't behave as it should ?
Ah or you asking how to reset all other rows to 0 when a row is updated to 1 ? You have multiple options such as using a trigger: https://docs.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql?view=sql-server-2017
Another option is to consider that being the default is NOT an attribute of each row but rather a fk from a configuration table (and so by design you can always define only a single default row).