tags:

views:

17

answers:

2

i want to modify my table in sql express edition.. after the modification, i also have chnged my primary key.. but when saving the modified table, it gives error that :

RegistrationForm' table - Unable to modify table.
Cannot insert the value NULL into column 'ID', table 'StudentRegistration.dbo.Tmp_RegistrationForm'; column does not allow nulls. INSERT fails. The statement has been terminated.

A: 

That indicates that your changes would result in existing rows failing the constraints on NULL values.

Have you added the ID column?

If so, looks like it may be a primary key. If it is an int/numeric, you should probably turn on Identity Seeding.

Program.X
ya i want to add the ID column...
Abid
i want to add the ID column while modifyng and set it as a primary key..
Abid
If there are rows in that table, either allow NULLable values and manually go into the rows and assign appropriate values or (recommended) turn on Identity Incrementing in the column properties. SQL will auto-seed it for you.
Program.X
but that identity incrementing is hidden.. and i cant select the yes option..it`s default to No and that is hidden
Abid
That property is an expansion property. Click the [+] icon to the left and it will drop down two rows which *can* be modified. It's a bit "dukka", I know. Just toggle the top of the two rows. (assuming you're using SQL Management Studio
Program.X
while selecting the cloumn that is set as a primary key, then do i select the identity increment property??
Abid
by the way.. when i select any of the column and select the identity increment, it`s hidden..
Abid
I'm not sure what is happening on your client or the difficulties you are having with this. I've created a screenshot with instructions here: http://programx.co.uk/media/p/4145.aspx
Program.X
i dont knw y.. in this identity specification identity increment is hidden.. and i can`t select it to yes.. :(((
Abid
Have you scrolled to the bottom of the properties panel? Other than that I can't explain why you wouldn't see this property. It even appears (but is greyed out) for unsupported data types.
Program.X
+1  A: 

Table def and ddl query might help but try setting a default value of 0, or start by creating the column as nullable, then populate it and change to non nullable.

Paul Creasey
ddl query nd table def ??
Abid
what is this query.. can u help me doing that.. because i`m doing a simple insert update and delete query and i dont knw about table def and ddl query..
Abid