>>>>>>Hi,
>>>>>>
>>>>>>Yesterday, a customer had to restore one table in the SQL Server DB. The reason was that they made a mistake, updated multiple rows and it was wrong. So, the DBA restored the table from the backup.
>>>>>>
>>>>>>Now, whenever they (any user) try to add a row/record to this table, an error comes up that the sql server cannot insert the value NULL into a column "so_and_so". And if I change the column to allow null, the error goes to the next column that does not allow NULLs. I checked that there are many columns that do not allow nulls and it worked before. Now it failed.
>>>>>>The application is using CursorAdapter.
>>>>>>The application has not been changed.
>>>>>>
>>>>>>Any suggestions?
>>>>>>
>>>>>>TIA
>>>>>
>>>>>You should have DEFAULT values for the columns that does not allow nulls (unless of course they should be filled by the application)
>>>>>The other way is to set DEFAULT values in your CA CursorSchema property.
>>>>
>>>>You were right. Many columns have a default set to a value 0 (zero) or an empty string. But some others have default set to dbo.UW_ZeroDefault. This default was wiped out when the customer restored the table from the backup.
>>>>Once I set the default of those columns back to dbo.UW_ZeroDefault, everything works again.
>>>>I can't thank you enough!!!
>>>
>>>>>This default was wiped out when the customer restored the table from the backup.
>>>
>>>Which is why it's a good idea to explicitly set each value when inserting a row.
>>
>>I will consider adding this feature. Thank you.
>
>This feature might protect your table against bumbling users inserting rows
>via Odbc (think Excel or Vfp command or other tool)
>as the null columns will error out.
>
>No protection against willful bad hat, as even stupid ones will figure it out fast,
>but better than nothing.
OK
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham