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!

  • What SQL/Server version? DB2/MSSQL/Oracle? – Dog Ears Oct 14 '09 at 14:13

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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