Though there is no straightforward solution but it can be done in the following steps:
First, update child tables: You must retrieve all tables that reference your Project table and make a query to disable relation constraint check on them and then update the FK columns on each table separately.
The following query is based on this post that allows to make two commands: cmd1 for disabling relations and updating the FK columns and cmd2 to restore relation checks.
SELECT
fk.name 'FK Name',
tp.name 'FK table',
cp.name 'FK column',
'ALTER TABLE ' + tp.name + ' NOCHECK CONSTRAINT ' + fk.name + ';' + 'update ' + tp.name + ' set ' + cp.name + ' = ' + cp.name + ' + 15;' cmd1,
'ALTER TABLE ' + tp.name + ' CHECK CONSTRAINT ' + fk.name cmd2
FROM
sys.foreign_keys fk
INNER JOIN
sys.tables tp ON fk.parent_object_id = tp.object_id
INNER JOIN
sys.tables tr ON fk.referenced_object_id = tr.object_id and tr.name = 'Project'
INNER JOIN
sys.foreign_key_columns fkc ON fkc.constraint_object_id = fk.object_id
INNER JOIN
sys.columns cp ON fkc.parent_column_id = cp.column_id AND fkc.parent_object_id = cp.object_id
you can now copy and paste the cmd1 column to update all child tables.
Second, update the parent table: Your PK is identity as the error reads. As you know updating an identity column is not possible but there is a workaround:
--Copy the date to a new table without an identity column
select * into Project_backup from Project union all select * from Project where 1<>1
--Update PK
update Project_backup set id = id + 15
--Delete old data
delete from Project
--Enable identity insertion
SET IDENTITY_INSERT Project ON
--Insert into table
insert into Project (id,... /*List all columns here*/)
select * from Project_backup
--Disable identity insertion again
SET IDENTITY_INSERT Project off
Finally, enable relations constraints:
Using the cmd2 column of the above query now you can restore the relations.
Finally It’s done!