Semi-Technical – Intern to the Rescue Episode 93

New and Improved Bacon Flowchart

Occasionally I unearth a problem that I had no idea existed, but in doing so I save the world from something that they never even thought would be happening. Yesterday was one such event, and I saved Broadcom at least a week worth of debugging by spending a couple hours working with cursors and a temp database to check the integrity of our data after a major change to the contents. This is only semi-technical, so bear with me…

Overview

I am currently working on a project with high visibility within Broadcom. We have two disparate applications both tracking projects, their revision, a number of other overlapping fields and many other fields that are not shared. We defined one as the Master, because it has uniqueness and a number of data integrity checks, and the other as the Slave. The catch is that we have a many to one mapping between Slave and Master which means we have to look deeper.

Continue reading “Semi-Technical – Intern to the Rescue Episode 93”

Code Example – MSSQL Test Update

I posted, in june of last year, about some very useful MSSQL tests that make development and the promotion process we use here at Broadcom easier. One of the tests was not entirely correct, and id like to make a quick substitution (although i wont be replacing the previous entry because it sort of works too).

Does a table have a field already?

IF EXISTS (SELECT Coalesce(Col_length('dbo.T_Table', 'FieldName'), 0))
GO

should be

Does a table have a field already?

IF EXISTS (SELECT 1 WHERE Col_length('dbo.T_Table', 'FieldName') > 0)
GO

sorry about the mixup. This new one is much simpler to read share with your friends and actually works well.

Code Example #4 – MSSQL Tests

This week I am working on extending an application that takes advantage of the MSSQL servers that proliferate my company. I am writing a number of changes, altering, creating and dropping tables, and unfortunately – the scripts have to be executed a number of times. This poses a simple challenge. I don’t want to be executing SQL that has already been executed on a previous run, so I have had to get creative in my queries in order to avoid this overlap. Below are a few of the tests that I am using.

Does a table exist?
Does a table not exist?
Does a stored procedure exist?
Does a table have a field already?

This week I am working on extending an application that takes advantage of the MSSQL servers that proliferate my company. I am writing a number of changes, altering, creating and dropping tables, and unfortunately – the scripts have to be executed a number of times. This poses a simple challenge. I don’t want to be executing SQL that has already been executed on a previous run, so I have had to get creative in my queries in order to avoid this overlap. Below are a few of the tests that I am using.

Continue reading “Code Example #4 – MSSQL Tests”