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 |
brianlewis
Starting Member
1 Post |
Posted - 2008-01-28 : 17:18:03
|
I have a view called 'comlineemail' on my SQL database that has many columns of data. Two columns inparticular are set to <NULL> right now and I need to figure out a way to fill their values from data in another column (same comlineemail' view). Column USERID (source data)Column MAILADDR (needs to be USERID@mydomain.com)Column USERDIR (needs to be c:\imail\USERID)Can anyone help me with a query that I can execute that will use this comlineemail view and update the MAILADDR and USERDIR fields with the value USERID&'@mydomain.com' and 'c:\imail\'&USERID where MAILADDR is NULL? |
|
singularity
Posting Yak Master
153 Posts |
Posted - 2008-01-28 : 21:23:50
|
Add the following to the SELECT statement of your view:USERID + '@mydomain.com' AS MAILADDR, 'c:\imail\' + USERID AS USERDIR |
 |
|
bama0906
Starting Member
5 Posts |
Posted - 2008-01-28 : 21:43:25
|
This logic will update a table, so you should be able to change it to a select and use with your view. You may or may not have to use the trim depending on your datatype. UPDATE tblTestSET MAILADDR = rtrim(USERID) + '@mydomain.com', USERDIR = 'C:\imail\' + USERID |
 |
|
|
|
|