Hi,I have a table called Candidate some of the fields are:candidate_id primary key, int, identity not nullreal_candidate_id int not nullcountry_id intI want to insert a new record to the table. The value for Real_candidate_id must be the same as candidate_idIf the country_id is 2 or 47 then i need to add 9999 before the candidate_id and the value therfore for real_candidate_id will be 9999 and the candidate_id.I tried the following query but it doesn't work. I get the error:Cannot insert the value NULL into column 'Real_candidate_id', table 'IIB_America.dbo.Candidate'; column does not allow nulls. INSERT fails.INSERT INTO Candidate (Real_candidate_id, Title, SurName, Given_Names, Address1, city, Post_Code, Country_id) values(case when @country_id in (2,62,47) then convert(bigint,'9999'+(convert(varchar(20), (SCOPE_IDENTITY())))) else (SCOPE_IDENTITY()) end, @Title, @SurName, @Given_Names, @Address1,@city, @Post_Code, @Country_id)
Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much.