Error after recreating Database

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hello,

I deleted my database, recreated the database and imported data from my development environment.
When i run the application i get this error message:

Cannot insert the value NULL into column 'Id', table 'DBName.dbo.Customer'; column does not allow nulls. INSERT fails.
The statement has been terminated.

What do i do?

Thanks
11 years ago
How did you "recreated the database and imported data"?

It's best to use SSMS to BACKUP your dev DB, and then RESTORE using "Overwrite ..." (on Options page)
10 years ago
chinenye wrote:
Hello,

I deleted my database, recreated the database and imported data from my development environment.
When i run the application i get this error message:

Cannot insert the value NULL into column 'Id', table 'DBName.dbo.Customer'; column does not allow nulls. INSERT fails.
The statement has been terminated.

What do i do?

Thanks



I faced the exact same problem as above and after few hours of googling i figured out what exactly was the cause of above error in my website.

Cause: I took backup of my database and recreated on other sql server. When i checked the new database i found there are no dependencies between related tables and also no primary keys set on tables.

Fix: Recheck your database if you have recreated or restored the old backup as in my case. After your database is fixed, go to IIS and refresh the application pool. If you do not have access to IIS directly as in most cases, go to root directory of your website and edit web.config file by adding a space at the end of file and re-save it. This will refresh the application pool itself.

Hope it helps others facing the same problem.
10 years ago
skjatolia wrote:
Hello,

I deleted my database, recreated the database and imported data from my development environment.
When i run the application i get this error message:

Cannot insert the value NULL into column 'Id', table 'DBName.dbo.Customer'; column does not allow nulls. INSERT fails.
The statement has been terminated.

What do i do?

Thanks


I faced the exact same problem as above and after few hours of googling i figured out what exactly was the cause of above error in my website.

Cause: I took backup of my database and recreated on other sql server. When i checked the new database i found there are no dependencies between related tables and also no primary keys set on tables.

Fix: Recheck your database if you have recreated or restored the old backup as in my case. After your database is fixed, go to IIS and refresh the application pool. If you do not have access to IIS directly as in most cases, go to root directory of your website and edit web.config file by adding a space at the end of file and re-save it. This will refresh the application pool itself.

Hope it helps others facing the same problem.


can't u just check the overwrite option as mentioned by user New York above in SSMS?
10 years ago
prodev42 wrote:

can't u just check the overwrite option as mentioned by user New York above in SSMS?



You seem so arrogant with your words. Can't you see I proposed CAUSE and FIX for the issue in addition to what New york mentioned to help others who may face the same issue.

FYI I restored my backup on blank database, it doesn't matter if the overwrite option is checked or not.
10 years ago
skjatolia wrote:

can't u just check the overwrite option as mentioned by user New York above in SSMS?


You seem so arrogant with your words. Can't you see I proposed CAUSE and FIX for the issue in addition to what New york mentioned to help others who may face the same issue.

FYI I restored my backup on blank database, it doesn't matter if the overwrite option is checked or not.


u r 2 sensitive =) in no way or form am i trying to be "arrogant" plz only discuss about nop related issues..not judging other ppl
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.