Using SQL Analyzer for mass update

  • I would like to do a mass update using SQL Analyzer. I want to update the e-mail field with fname.lname@domain.com.

    I have two fields fname and lname. I would like to use these 2 fields and add them to @domain.com which will be placed in the email field. How would I do this?

    update tablename

    set email = ?????

    I can't quite figure out how to write out the update statement.

    Thanks in advance!

     

  • you just concatenate the fields with the hardcoded stuff;

     

    update tablename

    set email = fname + '.'+ lname + '@domain.com'

     

    here's a substring example in case you wanted first initial + lastname:

    update tablename

    set email = substring(fname,1,1) + lname + '@domain.com'

     

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks! I was putting quotes in the wrong places. I appreciate it! Mondays are just not my best days

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply