Solved

Sql query to update a column without overwriting the existing data.

Posted on 2008-06-16
2
664 Views
Last Modified: 2012-05-05
How do we update a column in SQL database without overwriting the existing data?
0
Comment
Question by:Anandhi1
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 250 total points
ID: 21795697
i didbt understand, you mean to update a paticular column with entirely new value in that case try this

update urTable
set urColumn = 'newValue'
 where somePrimarykey = 'someUniqueValue'

if you want to append to the exisitng one

update urTable
set urColumn = urColumn +  'newValue'
 where somePrimarykey = 'someUniqueValue'
0
 
LVL 8

Expert Comment

by:i2mental
ID: 21795723
update table1
set field1 = 'whatever' where field1 is null

only writes into blank field1
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question