UPDATE changes the values of the specified columns in all rows that satisfy the condition. Only the columns to be modified need be mentioned in the SET clause; columns not explicitly modified retain their previous values.

learn more… | top users | synonyms

0
votes
1answer
8 views

How to limit the range of an insert-update to only look at certain rows/ rows with field value: X?

I posted something similar before, but am still unsure of the technical implementation --- I'm so close to being there to the finished product. I have a table of tickets, and a stream of ticket ...
1
vote
1answer
39 views

MySQL Deadlock - accessing different primary key values also creating deadlock

I went through MySQL logs and found the reason for deadlock 1st thread is trying to execute below query. Which is waiting for thread 2. UPDATE M_SAMP SET MM_Q_IND=0 WHERE M_ID IN (SELECT M_ID FROM ...
0
votes
0answers
18 views

Efficient Trigger updating in Postgresql

So I have a big table that often needs specific columns updated for a large number of rows. So right now I have it set up so that there is a 'staging' table that has the update-able columns. Then upon ...
0
votes
0answers
18 views

How to find Deleted and Updated record tables in MYSQL database?

I have scenario like below. I need to find Deleted records and updated records effected tables in mysql. Ex: I update my Name or Email Id in UI that is effected in some tables either one table or ...
0
votes
1answer
26 views

Is it possible to update a field value in one table based on data inserted into various other tables?

Suppose I have a table representing clients. There is a field called last_active in the table which contains a time stamp. When a client uses the database they can insert data into one of four ...
0
votes
1answer
17 views

Update multiple meta_value with single query

Here is a similar structure of a table that I am working on. |--ID--|--user_id--|--meta_key---|--meta_value--| |--1 --|--444444---|--first_name-|------NULL----| |--2 ...
0
votes
0answers
28 views

Sleeping queries blocking rebuild index and update statistics job in Always on

At one of your client sides we have configured Always on with synchronous mode.Also we have schedule rebuild index and update statistics job which runs in night every alternate day. the issue is ...
0
votes
1answer
25 views

MySQL Cluster error on UPDATE: increase MaxNoOfConcurrentOperations

I had a table with ~0.5M rows and tried to exec simple query, something like UPDATE table SET col1=-90 + RAND()*90, col2=-180+RAND()*360 WHERE col1=9999 but result was ERROR 1297 (HY000): Got ...
0
votes
1answer
24 views

Update statement with a function

I'm just curious. I was trying to optimize an update statement with a function Ex update circle set area = fnGetArea(radius) where ...<bunch of conditions> This update went 5-10mins and when ...
0
votes
1answer
53 views

How to update a (very) large table without locking in MySQL

I have a large table (58+ million records) which represents a relation between two records (player and target) in a second table. Unfortunately, whoever designed our schema didn't think things ...
1
vote
2answers
46 views

How to update the parent/child of all rows in the tree (ltree)?

Here are my configurations: DB type: postgresql (9.3 if that's necessary) Table name: product_sections Column names: section_id (integer) & section_path (ltree) Detail: I have one reference ...
1
vote
1answer
23 views

Updating one table from another table where non-primary-key field is similar string

I have a database in Access that I am trying to fix (actually, I'm working on a copy of the original). There are two tables, one with data input errors, and a second that is a copy of those errors, ...
1
vote
1answer
76 views

Updating large table (~6.5 million rows) & indexes

I'm trying to update a table with about 6.5 million rows in a reasonable amount of time, but I'm having some issues. We're adding a new column to an existing table and then setting a value for all ...
0
votes
1answer
34 views

Update does not working while select returns right results

I am trying to execute the query below: UPDATE( SELECT Ord.Completed FROM Product P INNER JOIN Order1 Ord ON Ord.OrderID = P.OrderID WHERE EXISTS( SELECT * FROM Delivery ...
2
votes
1answer
66 views

Updating large table worked before, now taking hours

BACKGROUND: I am using a non-production SQL Server to manipulate a large data set and run a few basic calculations. The original data file I have, which is about 30M rows, is missing records (not ...
1
vote
2answers
68 views

T-SQL — Why do ALTER and UPDATE statement only run when separated into their own batch?

I have update and alter statements that are only running when they are put into they're own batch. Below is my shortened version. It'd probably be a good idea to skip the code and read my question ...
0
votes
1answer
17 views

Are my MongoDB servers right in setting?

I have a small web site, so I used two servers. A: master 4G Ram, 96G SSD B: slave 2G RAM, 96G SSD The B server is always for backup, no read, no write. In my application, many users can (and will) ...
-1
votes
2answers
83 views

Update code works in manual stored procedure but not when run as SQL Server Agent Job

I have a stored procedure that deletes all records from an existing table, and then inserts new records. After the insert I have several update operations that change the value of one field. If I run ...
2
votes
0answers
88 views

Update all rows

I want to know the most efficient manner to update every row in an extremely large Oracle table for a single column. For example: update mytable set mycolumn=null; or: update mytable set ...
0
votes
1answer
57 views

How do I report progress of a long running transaction in MySQL?

I have this transaction in a stored procedure: ... START TRANSACTION; WHILE @Codes > 0 DO EXECUTE qry_rand_stmt; EXECUTE qry_insert_stmt; SET @Codes = @Codes - ROW_COUNT(); END ...
-2
votes
1answer
49 views

Find difference between two database and output them in a script sql [closed]

I had a SQL Server 2008 R2 database. I have dump it and made some mods in a copy. So, I have two databases: 1) the older version 2) the new version I need a script SQL to update the number 1) to ...
0
votes
1answer
35 views

Compare two columns for difference mark the difference in mysql

I need to compare two fields and mark the similar fields in third table. For Example: Tables customer: phone id, phonenumber followstatus received_Customer: rc_id, rc_phonenumber. I ...
1
vote
0answers
35 views

How to use the value from record like as varchar?

I'm trying update a old table with result of selec for another tables but get a error using this sintaxe (e.g.): DO $$ DECLARE _roles refcursor; _onerole varchar; _record RECORD; ...
0
votes
2answers
31 views

DBO execute returns true but doesn't execute

I am having a bit of trouble with some of my code. This is the code: $STMT3 = $PDO->prepare(' INSERT INTO `lotteries_entries` (steamID, lottery_id) VALUES (:STEAMID, :ID); UPDATE ...
1
vote
1answer
34 views

Index that mimics full-text-index

I have a database that is retrieving information quite slowly, I asked a question and was told to use full-text-indexing, this worked, but now we switched over to a .sdf file and Sql Server Compact ...
0
votes
1answer
36 views

Why Does the Update Statement also updates indexes?

I am currently learning about SQL queries and how indexes work with them, and I ran into a situation that I don't understand. Let's say I have this query for that updates a tables' values with another ...
0
votes
1answer
83 views

How to update a huge MySQL table from a text file

I have a huge MySQL table with 1.3 TB data with InnoDB engine format. Now I have a text file containing updated values of 2.2 GB of records in the 1.3 TB of data. How do I proceed ? I am a newbie ...
0
votes
1answer
18 views

Update Trigger in MYSQL

Here is my requirement :- I have a table called "users" and field called "Admin". Field "id" is primary key. Wants to update "Admin" field to "1" if id=1000; Tried this ,but not working.I tried ...
0
votes
1answer
62 views

Update and Insert Statement taking forever

I have a database with two columns that is called using the following query: SELECT TimesUsed, Word FROM Predictions WHERE (Word LIKE @partialWord) ORDER BY TimesUsed DESC In my application it is ...
0
votes
1answer
54 views

Slow Postgres updates if OTHER columns are indexed?

Certain updates take far too long on large Postgres tables. Given these conditions: only one column is being updated, and it is non-indexed the column already has data in it for every row due to a ...
0
votes
2answers
30 views

Update all data in a table without affecting ID(PK)

I'm using SQL Server 2005. I have a table with 4846 customer records. The PK is called ID and spans from record 40003 to 79870. This numbers are used a other tables to hold info about user orders, ...
1
vote
2answers
642 views

Update statement is giving an invalid column name error, even though the column exists

I have a temporary table created at the beginning of this stored procedure. It is created successfully and can be selected from and inserted to. Here is the create statement CREATE TABLE ...
0
votes
0answers
16 views

update multiple column from multiple tables [duplicate]

I am trying to update multiple columns from multiple tables. My query like below but this is not working , how can write in correct way to update this. UPDATE Z_test_agl_asset a Z_test_cust_att c ON ...
0
votes
0answers
92 views

update multiple columns from multiple join tables with selected data from multiple tables in where condition

please help me. UPDATE Z_test_agl_asset a, Z_test_cust_att c ON (c.customattributes_id=a.asset_customattributes_id) , Z_test_cust_att cc ON (cc.customattributes_id=c.extendedcustomattributes_id) ...
0
votes
1answer
53 views

Update an array element with inc mongo update

HI All I have this Data in mongo, {"articleId" : [ { "articleId" : "9514666", "articleCount" : 1 } ], "count" : NumberLong(1), ...
0
votes
1answer
73 views

using update query with subquery in Oracle sql

I have an update query where I am trying to update a field but for more than one record, I am trying a join but it doesn't work. Below I get multiple values that come back from the select statement ...
2
votes
3answers
612 views

Cascade primary key update to all referencing foreign keys

Is it possible to update a primary key column value with cascading the update among all the foreign keys referencing it ? # EDIT 1: When I run followinq query select * from sys.foreign_keys where ...
1
vote
3answers
657 views

How to handle big data update based on excel spreadsheet

Scenario Select-based data is exported from DB to Excel spreadsheets. Some manual work is done on the excel files (filling missing data). Changed data from excel files is updated back to DB. ...
0
votes
1answer
81 views

$addToset do not work in update if record not exists

I am trying to use following query db.TestColl.update({ "tags" : "silk" , "host" : "host.com"},{ "$set" : { "cat" : "MOVIE","publishTime" : 1370427540000 }, "$addToSet" : { "articleId" : { "$each" : ...
0
votes
2answers
160 views

update column based on sum of data from another table

I have two tables : Table1 (col1, col2, col3, col4, val1, status) Table2 (col1, col2, col3, col4, val2) For Table1 and Table2, The columns (col1, col2, col3, col4) are the composite primary key. ...
1
vote
1answer
64 views

PostgreSQL, UPDATE CASE statement uses huge amount of space

I am running a CASE statement on one of my tables and it consumes a huge amount of hard drive space that is never freed up even when i run VACUUM ANALYZE. Autovacuum is ON as well. I am using ...
1
vote
1answer
46 views

Mysql update adding subquery field value to field

I want to update a field adding it the value of a subquery field. I'm trying this: UPDATE table a SET a.field=(a.field+b.subfield) INNER JOIN (SELECT subid, subfield FROM subtable WHERE ..... ) AS ...
1
vote
1answer
20 views

SQL - Update table for a unique ID with multiple entries if one entry has variable in question

I'm trying to update a table to fill in a variable to each row in the table if one row for the unique ID shows that variable. I was trying to do the following, but it's giving me an error. ...
2
votes
1answer
69 views

Does a database update force index rebuild regardless of updated field?

With MySQL (InnoDB), I understand that having indexes slow down UPDATE queries. I would like to know if this happens regardless of what fields are updated. For example, if I have a table with 20 ...
0
votes
2answers
157 views

How to update a column with values from the same newly inserted row on a SQL Server 2014 trigger?

Using SQL Server 2014, I have this: Table1 Tab1_id int identity(1,1) primary key Tab1_val1 smallint Tab1_val2 smallint Tab1_valInfo varchar(10) -- not yet implemented, will be used ...
6
votes
2answers
249 views

Is this update, select combination query thread safe?

I have a table called seats, which has a schema like this id,taken For each user, I take a random untaken id and assign to that user, here for simplicity say, I make taken =1. The query I am ...
0
votes
2answers
47 views

Can I update only the needed changes in a database?

First of all, I apologize if you can't understand very well what I am saying and it can be edit for better understanding of my post. The next example is for better understanding of databases with ...
0
votes
1answer
196 views

Store the resulting list of a SELECT in a variable to count AND use the result

I have stored procedure that uses a cursor and for every fetch a duplicate SELECT, once to determine the number of IDs found (SELECT COUNT(ID) FROM TableA WHERE something.. @cur_var) and if the ...
0
votes
1answer
43 views

Updating MySQL innodb table based on multiple joins

I have a table with the following (slightly simplified) structure CREATE TABLE `oak_relation` ( `o_id` int(10) unsigned NOT NULL, `k_id` bigint(20) unsigned NOT NULL, `initial` float unsigned NOT ...
2
votes
0answers
56 views

How to optimize update using join in postgresql

I'm using PostgreSQL 9.3.5 on a CentOS system. I have a very large table (twenty million rows, 50+ column) that aggregates data from a few hundred systems. Several times a day each of the systems ...