Jump to content

Adding info to an existing DB field using SQL


Martinl3
 Share

Recommended Posts

I have a website using ASP pages and a Microsoft Access DB using SQL to manage the interface.  I want to add the option to add to existing data in a specific field instead of replacing that data.  I know how to use the UPDATE function to replace the data in a field but I want to add to that data, not replace it.  I have been retired for 6 years and had no reason to stay up on these items but now I have the need again and am really rusty.

Thank you in advance.

Link to comment
Share on other sites

I'm not sure if your SQL server supports it, but in MySQL you would be able to do this.

In the UPDATE query, you would just have to concatenate a value onto the existing value like this:

UPDATE `table` SET `field` = CONCAT(`field`, 'New data') WHERE id = 1

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...