Oracle SQL: Update table with data from another table

Task:

Let’s suppose you have Table1 with a million rows and you just altered the table by adding a new column. This new column is empty (NULL) in Table1 but you want to update it with the values that are in a column in Table2.

Solution:

First, do not ruin your day, create a backup table with the same structure and data as TABLE1 by running below query:

CREATE TABLE TABLE1_BKP AS SELECT * FROM TABLE1;

Then test the update query by running below query:

UPDATE TABLE1_BKP A SET
A.COLUMN_TO_UPDATE = (SELECT B.COLUMN_WITH_DATA FROM TABLE2 B WHERE B.COLUMN_WITH_DATA IS NOT NULL AND B.ID = A.ID)
WHERE A.ID IN (SELECT B.ID FROM TABLE2 B WHERE B.ID = A.ID);

If the update went well, run the same query again but replace TABLE1_BKP with TABLE1.

It goes without saying that any UPDATE and DELETE queries must have a WHERE clause to limit the result as much as possible, in case something unexpected happens. And that’s why you need a backup table and test on it first.

Deploy Office 2007 SP2 with ConfigMgr 2007

As Microsoft recently released Service Pack 2 for Office 2007 suite, it is a good idea to add the update files to the package so it can be installed during the installation.

So, first of all we have to download the SP2 executable file from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=b444bf18-79ea-46c6-8a81-9db49b4ab6e5&displaylang=en (see Visio and Project information at the end of this post).

Then, using a command prompt window, extract the content of the package to a folder you can browse to.

Accept EULA and click Continue.

Select a folder to extract the files to.

When the extraction is complete, you should have the following files:

At this point, you can delete the office2007sp2-kb953195-fullfile-en-us.exe file. Copy the other 9 files to “Updates” folder from your Office 2007 source folder.

Now you only have to update the distribution point/s and the next time Office 2007 will install, it will apply the SP2 update during Office 2007 installation.

Additional info:

The same steps are valid for Visio and Project 2007.

Microsoft Office Visio 2007 Service Pack 2 (SP2) can be downloaded from here: http://www.microsoft.com/downloads/details.aspx?familyid=78E36742-8BDA-471E-88E6-9B561BB06258&displaylang=en.
Microsoft Office Project 2007 Service Pack 2 (SP2) can be downloaded from here: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c126fa4a-b43f-4f7e-a9d4-522e92a6cfee.

Update proxy settings used by Software Updates role in SCCM 2007

Few months  ago I had an interesting problem at a client site that took me a while to resolve. So I want to post it here, maybe it will help others…

After a successful upgrade from SMS 2003 to SCCM 2007 SP1, I configured software update point, synchronized with Microsoft update to get the list of updates for products I needed and created a new list with updates required by clients. When I tried to deploy software updates it should download the updates to my SCCM server. Well, this step failed. PatchDownloader.log reported the following:
Trying to connect to the root\SMS namespace on the XYZ-SCCM machine
Connected to \\XYZ-SCCM\root\SMS
Trying to connect to the \\XYZ-SCCM\root\sms\site_XYZ namespace on the machine
Connected to \\XYZ-SCCM\root\sms\site_XYZ
Download destination = \\XYZ-SCCM\WsusContent\08123a3c-c7fd-43a4-a4ce-80089b1267df.1\WindowsXP-KB938828-x86-ENU.exe
Contentsource = http://www.download.windowsupdate.com/msdownload/update/v3-19990518/cabpool/windowsxp-kb938828-x86-enu_ba3f0cbe4ba5736d4254732e41fe058697b76ebc.exe
Downloading content for ContentID = 8170, FileName = WindowsXP-KB938828-x86-ENU.exe
Try username DOMAIN\USERNAME from the registry
Proxy enabled proxy server ISAserver:8080
HttpSendRequest failed 12007
Download http://www.download.windowsupdate.com/msdownload/update/v3-19990518/cabpool/windowsxp-kb938828-x86-enu_ba3f0cbe4ba5736d4254732e41fe058697b76ebc.exe to C:\DOCUME~1\ADMINI~1.LAB\LOCALS~1\Temp\2\CAB3B.tmp returns 12007
ERROR: DownloadContentFiles() failed with hr=0x80072ee7

First I thought it was a stupid error, as I set (and checked twice) all correct information. Looks like proxy information was old and not updating with what I have set later in SCCM. So I needed to remove old information and set the new ones again.

I have checked the registry and I couldn’t do much as username and password was encrypted. Well, I used upddwnldcfg.exe (from <ConfigMgrInstallationFolder>\bin\i386\00000409 folder on a x86 machine) to delete all proxy information stored in the registry and added the new username, password and server’s IP address. After this, downloading updates worked perfectly. More information about configuring proxy settings using upddwnldcfg.exe, you can find here: http://technet.microsoft.com/en-us/library/bb892795.aspx