Can someone tell me how to append in SQL? I've going around all day trying to figure this out. This is what I have so far:
update table1
set field1 = field1 + '123456'
where field2 = '12'
Sorry, I forgot to mention that I'm updating more than one field in the statement.
We will use Append Query in SQL. For Implementing the Append Query in SQL Here First of all we will create Database and inside the we will create a table with some Record. For database creation there is query we will use in SQL Platform, like Mysql, oracle, etc.
The UPDATE command in SQL is used to modify or change the existing records in a table. If we want to update a particular value, we use the WHERE clause along with the UPDATE clause. If you do not use the WHERE clause, all the rows will be affected.
If you want to add data to your SQL table, then you can use the INSERT statement. Here is the basic syntax for adding rows to your SQL table: INSERT INTO table_name (column1, column2, column3,etc) VALUES (value1, value2, value3, etc); The second line of code is where you will add the values for the rows.
Your statement should work as long as field1 is not null or the data to be appended is not null.
Something like this could help in the case where field1 is null.
update table1 set field1 = ISNULL(field1, '') + '123456' where field2 = '12'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With