


In SQL, how to batch update a certain part of a specific data field in a table
In SQL. How to batch modify part of a certain item of data in a table
The best way is to modify in batches, that is, modify 5,000 items each time (do not modify more than 10,000 items at a time, otherwise it will affect performance).
Although we can use the merge command in 11g, it is best to make partial modifications and impact assessments first, because such operations are risky in a production environment.
If a misoperation occurs, it is best to ask the DBA to restore it. Although you will be blamed, it is still worse than making mistakes after mistakes and losing the chance of recovery.
If you are really confident about these modifications and only consider performance, you can use the following method (pk_col is the primary key of the table):
merge into xxx aa
using (select pk_col from xxx) bb
on (aa.pk_col=bb.pk_col)
when matched then
update set aa.datatype=66 where aa.datatype is null;
How to batch modify data table contents in SQL
Remove blanks first and then replace. If the blank space is a space, it will be easy to handle. Use the functions rtrim and ltrim to remove the space. If it is not a space,
You paste the data in sql into notepad, and then enter
in the sql query analyzerselect ascii ('that blank character') to get the ascii code of this blank, then
update table name set field name = replace (field name, char (just got the ascii code), '')
Just use your statement after removing all the blanks.
There is another way, which is to write all the blank spaces once. For example, a carriage return is char(13), a line break is char(10), etc. You can update the table name set field name = replace (field name ,char(10),'') ,
All possibilities have been replaced, only those are blank, and there are not many cases
How to batch modify part of a column of data using SQL statements?
update yourTable set RECTIME = dateadd(yy,2,RECTIME)
Explanation: select dateadd(yy,3,getdate())
DATEADD ( datepart , number, date )
parameter
datepart
is a parameter that specifies to which part of the date the new value should be returned. The following table lists the date parts and abbreviations recognized by Microsoft® SQL Server™.
Date part abbreviation
Year yy, yyyy
quarter qq, q
Month mm, m
dayofyear dy, y
Day dd, d
Week wk, ww
Hour hh
minute mi, n
second ss, s
millisecond ms
The above is the detailed content of In SQL, how to batch update a certain part of a specific data field in a table. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











If you suspect your hard drive encounters issues, you can check the drive for errors on Windows 7. This php.cn post talks about fixdisk Windows 7. You can follow the guide to check the hard drive for errors on Windows 7.

Have you ever encountered a black screen after installing a graphics driver like an Nvidia driver in Windows 10/11? Now in this post from php.cn, you can find a couple of worth trying solutions to the Nvidia driver update black screen.

Windows X-Lite Optimum 11 23H2 Home or Optimum 11 Pro could be your option if you need a custom lite system based on Windows 11 23H2. Go on reading and php.cn will show you how to download Optimum 11 23H2 ISO and install Pro or Home on your PC.

Many SurfaceBook users report that they meet the “core isolation blocked by ew_usbccgpfilter.sys” issue on Windows 11/10. This post from php.cn helps to fix the annoying issue. Keep on your reading.

Tips and Suggestions Notifications is a new design of Windows 11. It will give you suggestions and tips on some new features. But some of you may be bothered by the popup tips. You can read this post from php.cn to learn how to turn off tips and sugg

KB2267602 is a protection or definition update for Windows Defender designed to fix vulnerabilities and threats in Windows. Some users reported that they were unable to install KB2267602. This post from php.cn introduces how to fix the “KB2267602 fai

You must be familiar with the Windows P shortcut if you have more than one monitor. However, the Windows P not working properly might happen occasionally. If you are facing this problem, this post from php.cn can help you indeed.

Data recovery is always a heated topic. To successfully restore data from your device, you should know how it stores data. You can learn the difference between RAID recovery and hard drive recovery from this php.cn post.
