Questions tagged [sql-update]

An SQL UPDATE statement is used to change existing rows in a table.

An SQL UPDATE statement is used to change existing rows in a table.

The basic syntax is:

UPDATE table 
SET 
    Column1 = 'x',
    Column2 = 'y'
WHERE id=1

Tagging Recommendation

This tag should be used for general SQL programming language questions, in addition to tags for specific products. For example, questions about Microsoft SQL Server should use the tag, while questions regarding MySQL should use the tag. Tagging by product (including version, e.g , ) is the easiest way to know what functionality is available for the task at hand.

References

12009 questions
2
votes
1 answer

Update column issue tsql

Take a look at this Task is to sum 'ukupna bilansna i vanbilansna aktiva' for the same 'ID_Grupe' after the relation between TABLE_A and TABLE_B on 'mbr' and 'GRP_ID' has been made. (mbr and GRP_ID are clients id card numbers) Afterwards, we need to…
unknown
  • 461
  • 9
  • 23
2
votes
1 answer

Update field in table with result of select from other table in mySQL

I have a follow-up question to sum of counts of different columns of same table I want to update a field (Z) in another table (B), which also has 'ID' with the results (A.COUNT_TOTAL) of the select query: SELECT A.ID, SUM(A.COUNTS) AS…
2
votes
1 answer

Update columns based on order of another column grouped by another column in MySQL

This is my table: I need to update this table with an update query such that, after the update query my table should be: i.e) for a common_id I need to update the position starting from 1 by ordering the position for that common_id. This is just a…
Surya
  • 2,429
  • 1
  • 21
  • 42
2
votes
1 answer

Speed up updates on Oracle DB which a lot of records

I have to update table which has around 93 mln records, at the beginning DB updated 10 k records per 5 seconds, now after around 60 mln updated records, update next 10k records take 30-60 s, don't know why I have to update columns which are null. I…
2
votes
2 answers

Error creating update procedure

I am currently working on an update procedure. I have checked other stack posts, and Youtube, but I can't seem to run the code. Here's one code that I have found and tried to make it work: UPDATE db_owner SET Street = ISNULL(@Street, street),…
2
votes
2 answers

How to update data at text box into db?

I display the list(Item, Category, and Job) from database in table and user can click the list on the table and the data will display in the text box. The user can add, update and delete the list in the text box. After that click the button that…
J. Lee
  • 35
  • 6
2
votes
1 answer

Update with group by Clause in Mysql

I have this Employee_Detail table which looks something like below ID| EMP_NO| EMP_NAME| YEARMONTH| CURR_MTH_PAY_AMT| TOTAL_CURR_MTH_PAY_AMT| CURR_MTH_DED_AMT| TOTAL_CURR_MTH_DED_AMT 1| 1 | 'Alan' | 201712 | 100 | NULL …
sweetu514
  • 65
  • 1
  • 18
2
votes
1 answer

Mysql UPDATE JOIN with LOAD DATA INFILE from csv

Here are my tables : table1 id_town town_altitude_min town_altitude_max 1 NULL NULL 2 NULL NULL ... table2 id_town id_zipcode 1 1100 2 1100 3 1110 ... And my csv…
Kyllak
  • 21
  • 1
2
votes
1 answer

How to update self-referencing graph using Entity Framework?

I am using Entity Framework to deal with database, and I have self-referencing model as following: public class PhysicalObject { public PhysicalObject() { SubPhysicalObjects = new HashSet(); } [Key] …
Simple Code
  • 2,354
  • 2
  • 27
  • 56
2
votes
2 answers

What is the proper way to create an update trigger with a variable getting value from the same table?

I'm creating a update trigger where an employee can never have a salary that is greater than the president's. However I need to subquery the president's salary for comparison and the "new" updated employee's salary. I originally had the the subquery…
Kenny Ho
  • 383
  • 1
  • 5
  • 12
2
votes
2 answers

MySQL updating many records and columns in a table using a UPDATE and a SELECT

I've added the last three fields to this table, but they are blank. All of the records have the top three filled in. The table definition is, mysql> describe nh3tk; +-----------------+-------------+------+-----+---------+-------+ | Field |…
James
  • 1,764
  • 5
  • 31
  • 49
2
votes
1 answer

The implicit conversion of the nvarchar data type into varbinary (max) is not allowed. Use the CONVERT function to perform this query

Follow code: byte[] image1 = ConvertTo.Bytes(Request.Files[0]); byte[] image2 = null; ctx .Users .Where(x => x.Id == 1) .Update(x => new User() { ImageByte1 = image1, ImageByte2 = image2 }); Table definition: ImageByte1 varbinary(MAX)…
Matheus Miranda
  • 1,755
  • 2
  • 21
  • 36
2
votes
1 answer

Delete a row in a XML column of a SQL Server table based on attribute value

I have a XML column in a SQL Server table. The data looks like this:
Sparrow
  • 355
  • 4
  • 19
2
votes
2 answers

Insert and alter data based on condition SQL Server

I currently have Table1 that includes ID Gender 1 m 2 f 3 f 4 m 5 f 6 f Now i am looking to insert this data into a second table (Table2). But basically i am trying to insert it with the words 'Male' and 'Female'. So for example when…
Ryan Gadsdon
  • 2,272
  • 4
  • 31
  • 56
2
votes
5 answers

Update with a Select

How can I update StatusID in Table X using Table Y? Table X has SourceID and old StatusID Table Y has SourceID and new StatusID update x set StatusID= (select StatusID from Y) where SourceID = (select SourceID from Y) Is this right? I'm afraid to…
Madam Zu Zu
  • 6,437
  • 19
  • 83
  • 129
1 2 3
99
100