safi
safi

Reputation: 3766

How can I insert data without deleting the existing record in MS Access?

I want to add a record into access. The column name is Names: Now I want to add data into existing data, without deleting or adding the existing record

suppose:

id name     original name
1  blue       shoes   
2  black      shoes 
3  green      shoes

Now I want it like this suppose the record one is already there, and when user add the next two entries it should be like this

moreover: if a user send a new value to the column_name, so the value must be add to the name column without omitting the other value. If it is like blue and you send name value = black as a new value so it should look like blue black

id name    original name
1  shoes   blue black 

So how can I do this with an SQL statement

Upvotes: 0

Views: 2354

Answers (2)

James Gaunt
James Gaunt

Reputation: 14783

Something like this should do it

UPDATE tbl SET tbl.[original name] = tbl.[original name] + ' ' + @newName WHERE tbl.[name] = 'shoes'

You are losing all the relational goodness in the database however. So you probably want to take a long hard look at your design here and see if it can be improved (it almost certainly can).

Upvotes: 1

Henrik
Henrik

Reputation: 3704

update names set original_name = name where id = 1;

update names set name = "shoes" where id = 1;

and of course replace the id with the actual id and "shoes" with user input.

Upvotes: 0

Related Questions