August 16, 2008 at 3:10 pm
Hello,
Is there any way to update all the rows in a table table1 with scnario
suppose i have 100 records with a column phone_numbers
I want to add 91 in all the start of every phone number
***mAsOoD*** O
|
/\
August 16, 2008 at 3:27 pm
August 16, 2008 at 3:42 pm
bitbucket (8/16/2008)
Update Dbo.Table1 UPDATE dbo.location SET local_Phone = '91'+local_phone
Just to be sure, I'd add a check to make sure the numbers haven't already been updated...
UPDATE dbo.Table1
SET Local_Phone = '91' + Local_Phone
WHERE Local_Phone NOT LIKE '91%'
--Jeff Moden
Change is inevitable... Change for the better is not.
August 17, 2008 at 10:59 am
hello dear 1st thank you very much for help but I have tried the query but it is not working message is successful with 1 row changed but actually nothing is happening my query is like under
update table_users set mail_number='1'+mail_number where id='12';
I am using mysql .
***mAsOoD*** O
|
/\
August 17, 2008 at 11:29 am
masood24 (8/17/2008)
hello dear 1st thank you very much for help but I have tried the query but it is not working message is successful with 1 row changed but actually nothing is happening my query is like underupdate table_users set mail_number='1'+mail_number where id='12';
I am using mysql .
How are you determining that it is not working? Have you selected the row with id = 12 and verified whether or not the update changed the value?
What were you expecting to happen that did not happen?
Note: this forum is for Microsoft SQL Server 2005. Although we can help with general SQL questions, what works for Microsoft SQL Server may not work correctly for another product. The above should work the same in both MySQL and MSSQL.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
August 17, 2008 at 3:27 pm
masood24 (8/17/2008)
hello dear 1st thank you very much for help but I have tried the query but it is not working message is successful with 1 row changed but actually nothing is happening my query is like underupdate table_users set mail_number='1'+mail_number where id='12';
I am using mysql .
First, don't call me "dear".
Second, your original request was talking about phone numbers, not "mail_numbers.
Third, this is an SQL Server forum... the UPDATE in MySQL may be a bit different.
Fourth, please read and head the link in my signature below.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply