| | |
MS SQL Update Query
Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 2
Reputation:
Solved Threads: 0
Suppose a table ABC have column XYZ containing data
3PSY0001-06-08-F
3PSY0001A-07-09-P
3PSY0001-02-09-P
3PSY0001-07-07-F
3PSY0002-09-08-P
3PSY0002A-01-03-P
3PSY0002-07-07-F
How can i write a query so that the data ending with P without A can be updated with A.
For example, with that query, data
3PSY0001-02-09-P AND 3PSY0002-09-08-P will be updated as
3PSY0001A-02-09-P AND 3PSY0002A-09-08-P while the other data remains the same.
Please Help.
Warm Regards
3PSY0001-06-08-F
3PSY0001A-07-09-P
3PSY0001-02-09-P
3PSY0001-07-07-F
3PSY0002-09-08-P
3PSY0002A-01-03-P
3PSY0002-07-07-F
How can i write a query so that the data ending with P without A can be updated with A.
For example, with that query, data
3PSY0001-02-09-P AND 3PSY0002-09-08-P will be updated as
3PSY0001A-02-09-P AND 3PSY0002A-09-08-P while the other data remains the same.
Please Help.
Warm Regards
•
•
Join Date: Feb 2008
Posts: 42
Reputation:
Solved Threads: 13
MS SQL Syntax (Toggle Plain Text)
UPDATE ABC SET XYZ = LEFT(XYZ, 8) + 'A' + substring(XYZ, 9, 1000) WHERE XYZ LIKE '%P' AND XYZ NOT LIKE '%A%'
Last edited by huangzhi; Apr 23rd, 2008 at 10:33 am.
Hence Wijaya
www.ex-Soft.tk
www.ex-Soft.tk
![]() |
Similar Threads
- Please help with JSP mysql update query (JSP)
- Need update query--Remove the coma "," (PHP)
- passing variables threw query (MySQL)
- Error while trying the update query (ASP)
- ADO.Net SQL UPDATE using OleDBAdapter (C#)
Other Threads in the MS SQL Forum
- Previous Thread: insert data between SQL servers
- Next Thread: Osql issue
| Thread Tools | Search this Thread |





