Latest Post

iPhone 3.0 bugs

So here are details of two bugs I’ve found so far; In the Camera application in the bottom left corner is (I guess) your latest picture in your Camera Roll except the picture I’m being shown is about 6 pictures ago and not updating. I sync my iPhone to my iMac at home but as is often the...

Read More

SQL 2005 Update From

Posted by johnb | Posted in Uncategorized | Posted on 02-01-2009

Tags:

2

This is more for my own benefit, but I thought I’d add it here so all can see (and I can find later).

A client sent over a spreadsheet containing 2 columns, the PK and a column of string data. They wanted this data to be used to update existing data in their application.

My first thought was to reach for CF and do it there but SQL 2005 makes this task real simple (I found after a little bit of investigation).

First up, I imported the spreadsheet into a temp table (tempdata) and then using 4 lines of SQL updated the original table using the values from the temp table using the SQL 2005 Update FROM clause;

update objProduct
set displayname = tempdata.displayname
from objProduct,tempdata
where objProduct.productSKU = tempdata.productSKU

simple huh?

Comments (2)

All I have to say is WOW.

A simple explanation… Thanks!

Write a comment