+ 3
Is there anyway to insert data in column only in SQL?
like after inserting a new column im sql can we add data only?
1 Odpowiedź
+ 3
I am assuming you have SQL code to add a column
Now it is empty and you want to fill it
You could use a default value, and then remove the default if it won’t be applicable for future inserts
ALTER myTable
ADD myColOfCodes int not null DEFAULT 1 WITH VALUES
if this is not an appropriate solution, an UPDATE statement should do the trick
ALTER myTable
ADD myColOfCodeS int null
UPDATE myTable set myColOfCodeS =1 WHERE myColOfCodeS is null