Solved

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

Posted on 2008-06-16
2
656 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.‚Äč
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 INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

930 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now