Tuesday, February 10, 2009

Update table with data from another table in SQL Server

Ok, pretty much self explanatory

UPDATE table1 
    SET table1.col1 = table2.col1, 
        table1.col2 = table2.col2
FROM table1, table2
WHERE table2.col = table1.col

Or using alias:
    SET A1.col1 = A2.col1, 
        A1.col2 = A2.col2
FROM table1 A1, table2 A2
WHERE A2.col = A1.col

Friday, February 06, 2009

Best Practices for Query Optimization

I'd like to take note of few tips from Pinal Dave. Certainly good reminders when creating queries.

Thursday, February 05, 2009

Configure Module::Starter::PBP in Windows XP

I decided to use Module::Starter::PBP when creating modules. But I got this error the first time:

C:\dev\perl\modules>module-starter --module=Dir::Walk
The Module::Starter::PBP template: t/C:./Documents isn't in the template directory (C:\Documents and Settings\user\.module-starter\PBP)
Some quirky stuffs in Windows when using this module. The initial configuration as outlined in cpan doesn't work. You need to tweak your config a little bit to accomodate this. It's not really the module's fault, but more on the way Windows handles directories, you know, spaces and backslashes, which is really a constant annoyance when you are programming perl in Windows. Anyway, here's what I did to make it work.

1. Move C:\Documents and Settings\user\.module-starter\PBP to another directory, in my case I moved it to C:\dev\perl\modules\templates\PBP.
(It's the spaces in 'Documents and Settings' that's causing the issue).

2. Modify C:\Documents and Settings\user\.module-starter\config as follows: (Note that I changed the backslashes to forwardslashes).

author: Sam Dela Cruz
email: myemail@address.com
builder: ExtUtils::MakeMaker Module::Build
plugins: Module::Starter::PBP
template_dir: C:/dev/perl/modules/templates/PBP