Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two columns with two values.. I want to append some text to the left of all the cells of Column A and concatenate to the right of all the cells of Column B.

Basically I'm trying to avoid having to type in a whole bunch of sql updates. so for example if i have an excel with

ID Employee Name

135 Rasputin
76 Bush

I want to generate something like this

UPDATE EMPLOYEES SET ID = '76', WHERE employee_name= 'BUSH'

So perhaps a solution of appending text to the cells and then merging the rows?

I prefer a built in function as I'm not familiar with VBA thanks!

share|improve this question
What SQL/Server version? DB2/MSSQL/Oracle? – Dog Ears Oct 14 '09 at 14:13
up vote 2 down vote accepted

Assuming ID is in in Column A and Employee Name is in Column B

Try this: ="UPDATE EMPLOYEES SET ID = '" & A1 & "' WHERE EMPLOYEE = '" & B1 & "'"

in column C row one and then copy the contents of the cells down to generate SQL for each update.

Note: there's no comma before the WHERE.

share|improve this answer
Cool That works! :D – ayrad Oct 14 '09 at 14:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.