Rob Gonda's Blog

ORM: Transfer 0.6 Released

Mark just announced that Transfer 0.6 has been released. No major changes since the last 0.6 RC other than a few bug fixes; however, this is great news -- for me at least -- because now Mark can jump to the next few items on the road map, such as composite keys.
There are many methodologies in database design, and mines always end up with composite keys all over the place, which makes it a little more difficult to use Transfer, but no more! I'll be the first one to alpha test the new releases since I've been a major pain bugging for this enhancement.

Nicely done Mark!

SQL Automated Insert Statements

Generating SQL scripts from ms-sql can sometimes be painful. SQL does a great job in generating sql schema scripts, including tables, views, functions, stored procedures, triggers, constraints, and indexes, but where's my data? SQL DTS (Data transformation services) can help if you're moving the data between databases, but what if you need to send someone a change script? or simply generate install scripts? I can't believe SQL provides no options for that.
Behold, I proses the solution! While researching this problem, I finally found a flexible stored procedure that will generate insert statements.

Check out this list of examples:

Example 1:    To generate INSERT statements for table 'titles':
       
        EXEC sp_generate_inserts 'titles'

Example 2:     To ommit the column list in the INSERT statement: (Column list is included by default)
        IMPORTANT: If you have too many columns, you are advised to ommit column list, as shown below,
        to avoid erroneous results
       
        EXEC sp_generate_inserts 'titles', @include_column_list = 0

Example 3:    To generate INSERT statements for 'titlesCopy' table from 'titles' table:

        EXEC sp_generate_inserts 'titles', 'titlesCopy'

Example 4:    To generate INSERT statements for 'titles' table for only those titles
        which contain the word 'Computer' in them:
        NOTE: Do not complicate the FROM or WHERE clause here. It's assumed that you are good with T-SQL if you are using this parameter

        EXEC sp_generate_inserts 'titles', @from = "from titles where title like '%Computer%'"

Example 5:     To specify that you want to include TIMESTAMP column's data as well in the INSERT statement:
        (By default TIMESTAMP column's data is not scripted)

        EXEC sp_generate_inserts 'titles', @include_timestamp = 1

Example 6:    To print the debug information:
 
        EXEC sp_generate_inserts 'titles', @debug_mode = 1

Example 7:     If you are not the owner of the table, use @owner parameter to specify the owner name
        To use this option, you must have SELECT permissions on that table

        EXEC sp_generate_inserts Nickstable, @owner = 'Nick'

Example 8:     To generate INSERT statements for the rest of the columns excluding images
        When using this otion, DO NOT set @include_column_list parameter to 0.

        EXEC sp_generate_inserts imgtable, @ommit_images = 1

Example 9:     To generate INSERT statements excluding (ommiting) IDENTITY columns:
        (By default IDENTITY columns are included in the INSERT statement)

        EXEC sp_generate_inserts mytable, @ommit_identity = 1

Example 10:     To generate INSERT statements for the TOP 10 rows in the table:
       
        EXEC sp_generate_inserts mytable, @top = 10

Example 11:     To generate INSERT statements with only those columns you want:
       
        EXEC sp_generate_inserts titles, @cols_to_include = "'title','title_id','au_id'"

Example 12:     To generate INSERT statements by omitting certain columns:
       
        EXEC sp_generate_inserts titles, @cols_to_exclude = "'title','title_id','au_id'"

Example 13:    To avoid checking the foreign key constraints while loading data with INSERT statements:
       
        EXEC sp_generate_inserts titles, @disable_constraints = 1

Example 14:     To exclude computed columns from the INSERT statement:
        EXEC sp_generate_inserts MyTable, @ommit_computed_cols = 1


Download here the version for ms-sql 2000 or ms-sql 2005. I am sure there are some nice commercial solutions I should check out, so if you know any good one, please comment below.

75 of the Fortune 100 companies use ColdFusion

In use at 75 of the Fortune 100 companies and at more than 10,000 other companies worldwide, ColdFusion MX is one of the most widely adopted web technologies in the industry.

Check out Adobe for a list of customers and case studies.

ColdFusion Rocks!

Select * from Ben

Ben Forta has been blogging about mssql lately, but we shall thank him since it's useful information.
For example, here's a comparison between temp tables and table variables. I always use table variables -- a lot -- and they're quite useful. I never ran into any of the restrictions Ben mentioned, but it's good to know that if I run into any of them, there is an alternative; for example, I never had to Select Into a table variable, but I do see where it can be extremely handy.

Another nice post mentions how to perform case sensitive searches w/o changing the collation for the entire database. As you may know, you may define different collations when creating a database which will indicate the character set and case sensitivity among other properties, but you can use a different collation in run time; I actually did not know that. Ben shows two examples:

SELECT *
FROM MyTable
WHERE Col3 COLLATE SQL_Latin1_General_CP1_CS_AS LIKE '%foo%'
--- or ---
CRETE VIEW MyTableCS AS
SELECT Col1, Col2, Col3 COLLATE SQL_Latin1_General_CP1_CS_AS as Col3
FROM MyTable

This reminds me that I should blog more about SQL ... you may expect some coming soon.

Ajax, JavaScript, CSS, DOM: Get Firebug 1.0

People constantly ask me how do I debug Ajax applications or why is their Ajax call breaking, and 9 out of 10 times my first response is what is your http sniffer telling you? There are many sniffers out there, but I most of the times use firebug; it is a Firefox extension good not only for debugging your XMLHttpRequests, but it helps with HTML (inspect and edit), CSS (visualize, edit), JavaScript (Logging, set break points, execute code), ...
I use firebug every single day and Firebug 1.0, which went public beta today, has even more goods. Truly amazing, hats off.

ColdFusion MX 7.0.2 Cumulative Hot Fix 1 Released

ColdFusion MX 7.0.2 Cumulative Hot Fix 1 has been released, containing 14 fixes, none of which really affects my projects. It is recommended you apply this patch -- which only takes a few seconds -- if you are experiencing any of the problems described by Adobe.

This blog is running version 5.9.003. Contact Blog Owner