I have a very big database, each table have id column is big int (very long). Now my project is change and i have make it shorter, so to do it i need new func to create new id column as well as reset fk_key for all of them.
Can i create a loop to search all table use big-int id and in side of it i change a value and change fk as well.
My mean, in the past this project create by a not good id generate func, it make my id very long like: 21654615642132, so i need find new id generate func as well.
Changing from a bigint to an int will be problematic - because SQL Server has to modify every row in the table and validate each value meets the requirement of an integer.
If you have any FK's on those - they would have to be dropped, the FK column updated to the new data - and the FK recreated.
There is no simple fix where you can create a simple loop and make a mass change.