Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 foreign key relation

Author  Topic 

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-06-18 : 09:16:43
hi all

i want to insert null values into a column which is a foreign key
It has relation form other table.Is it possible to insert null to such a field .if so please tell the synatax to insert(i mean the process)

Thanks In Advance

Malathi Rao

cvraghu
Posting Yak Master

187 Posts

Posted - 2007-06-18 : 17:27:48
Yes..you can have null values in a foreign key column. You can provide null values to it, just like other columns.
Go to Top of Page

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-06-19 : 01:21:32
quote:
Originally posted by cvraghu

Yes..you can have null values in a foreign key column. You can provide null values to it, just like other columns.



ya i tried but its giving error as

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_bt_bug_bt_Resource2".

Malathi Rao
Go to Top of Page

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-06-19 : 01:38:22
quote:
Originally posted by cvraghu

Yes..you can have null values in a foreign key column. You can provide null values to it, just like other columns.



i have a primary key column of int type.
Iam setting identity specifiction to that column
and iam releting this primary key to other table.
i want to insert null into foriegn key column
Is it possible

Malathi Rao
Go to Top of Page
   

- Advertisement -