Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have designing in my web page .my database table the id is allow null value i have set ok.i had store the value in table.but i want Id values not allow null value .how to change in my table
i have use query


UPDATE [tblMainPhotosettings] SET [Id]=0 WHERE [Allow Nulls] IS NULL
ALTER TABLE [tblMainPhotosettings] ALTER COLUMN [Allow Nulls] INTEGER NOT NULL

but error display

Msg 207, Level 16, State 1, Line 1
Invalid column name 'Allow Nulls'.


I am begineer
Posted

When you are telling ALTER TABLE you have to specify the column name or names say ID in you case.

so that should be something like this
ALTER TABLE [tblMainPhotosettings] ALTER COLUMN ID INTEGER NOT NULL
 
Share this answer
 
SQL
UPDATE [tblMainPhotosettings] SET [Id]=0 WHERE Id IS NULL
ALTER TABLE [tblMainPhotosettings] ALTER COLUMN Id  INTEGER NOT NUL



use it
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900