automatically generate SQL “UPDATE” statements in the last column

Step 1: Open Your Excel File

Suppose your Excel has this structure:

EmpCodeName...(empty column for SQL)

L58882 | Mahmudul Hasan |  | 
L54459 | Emon |  | 

excel.png 66.42 KB
Step 2: Add SQL Formula in Last Column

In the first row of the last column (say column D), enter this formula:

="UPDATE EMPLOYER SET Hold = 'N' WHERE EmpCode = '" & A2 & "';"

👉 Explanation:

  • A2 = the cell where your EmpCode is located
  • Adjust the column letter (A) depending on your Excel layout

Step 3: Apply to All Rows


After entering the formula in the first row:

  • Hover over the bottom-right corner of the cell (you’ll see a + sign)
  • Double-click the fill handle → Excel will auto-fill all rows

Step 4: Copy & Paste as Text (Optional)


If you need to use these queries elsewhere:

  1. Copy the last column
  2. Paste as Values (Right-click → Paste Special → Values)
  3. Save as .sql or .txt file if needed