I’m having trouble inserting data from one column to another within the same table. I have no problem inserting individual rows but that is not what I want. I have a column called “PercentFull”, I am multiplying this value by .01 to get the decimal equivalent, which is what I want to be inserted into a column I’ve called “NewPercentFull”. I have tried the following:
insert into Table1 (NewPercentFull)
select PercentFull * .01
from Table 1
There is already data that populates the PercentFull column. However, after this query is executed, I get NULL for every column in my table, including the NewPercentFull. Anyone has an idea of how to achieve this? Thanks
Inserting data from one column, into another, from the same record, would involve using an
UPDATEstatement:With your query, you should’ve seen double the amount of records in
Table1after execution of that query.You’ve mentioned that the values were
NULLeven forNewPercentFull. If this is the case, then I think my query may returnNULLvalues too. This will occur whenPercentFullis alsoNULL.To avoid this, only UPDATE records which don’t have a
NULLvalue forPercentFull: