Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
robert693
Starting Member
42 Posts |
Posted - 2009-07-06 : 10:27:42
|
| Hello,I want to run a script to update a table. The table is called External and it has for fields: First_Name, Last_Name, Address, City, State, Zip, Phone, Fax, Email. The email field is not being used so we are going to use it for a faxing system. I want to change the email field to have the first name, last name, suffix, and fax number. The fax number has to be numbers only. For example, (309) 555-5555 should be 3095555555 in the email field. I have this so far, UPDATE [External] SET [External].Email = "RFAX:" & External!First_Name & " " & External!Last_Name & ", " & External!Suffix & "@/FN=" & External!Fax;I created this in Access first to see if it will work. I would like to know how to change the format of the fax number. If anybody can steer me in the right direction I would appreciate it! |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2009-07-06 : 10:42:52
|
| use nestedREPLACE(Fax, '(', '')etc... |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-07-06 : 10:46:14
|
quote: Originally posted by robert693 Hello,I want to run a script to update a table. The table is called External and it has for fields: First_Name, Last_Name, Address, City, State, Zip, Phone, Fax, Email. The email field is not being used so we are going to use it for a faxing system. I want to change the email field to have the first name, last name, suffix, and fax number. The fax number has to be numbers only. For example, (309) 555-5555 should be 3095555555 in the email field. I have this so far, UPDATE [External] SET [External].Email = "RFAX:" & External!First_Name & " " & External!Last_Name & ", " & External!Suffix & "@/FN=" & External!Fax;I created this in Access first to see if it will work. I would like to know how to change the format of the fax number. If anybody can steer me in the right direction I would appreciate it!
UPDATE [External] SET EMail = ('RFAX: ' + First_Name + ', ' + Last_Name + ', ' + Suffix + '@/FN=' + Replace(Replace(Replace(Fax,'(',''),')',''),'-', '')) |
 |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2009-07-06 : 10:58:18
|
| but I would rather leave email as it is and have this string ("RFAX:..." etc) created in my select statement. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|
|
|