Disabling triggers and constraints

Recently, I was in a situation where I had to move data from an old version of a database to a newer version of the same database. The structure of the database had changed slightly. I was trying to figure out what data to move first. I wanted to move data that was referenced before […]

Continue reading

Multiple Nulls in a column with a UNIQUE constraint

I came accross a situation where I needed to temporarily insert multiple rows in a table with a Null value in a column with a UNIQUE constraint on it. In other words, I wanted the values in that column to be unique, except when they are Null. According to ANSI SQL specifications, this should be […]

Continue reading

Comparing IDENTs in two versions of a database

For the past few days, I have been working on the new version of a database. The database was in development and had to go in production. Of course, the right structure and lookup tables data was in the development version of the database and the good data was in the old production database. Both […]

Continue reading

How to insert into the PK column when it is an auto-number

Normally, trying to insert data into an identity column (autoincremental column) results in an error message. However, there are cases when we need to do this, and using SET IDENTITY_INERT, it is possible. Here is how: SET IDENTITY_INSERT MyTable ON INSERT INTO MyTable(MyTableId, …) VALUES (42, …) SET IDENTITY_INSERT MyTable OFF Here is the message […]

Continue reading

I got my PPA Int’l eSata ExpressCard

After the misadventure with my nGear eSata EpressCard, I returned it, and I ordered a PPA Int’l eSata ExpressCard. This card uses the JMicron chipset and thus was recognized automatically by my MacBook Pro (OS X v10.5.5). It was not easy to find an ExpressCard with that chipset in Canada. Of course, it would have […]

Continue reading

How to compare dates without taking the time into account

Today, I had to fix a bug in a stored procedure that was not handling dates correctly. A date column was being compared to the current date. However, the current date also contains hour, minute and second values whereas the time part of the date column always contained 00:00:00. In other words, we did not […]

Continue reading

nGear eSata ExpressCard uses the Sil3132 chipset

Well, well, despite what the tech. support guy from nGear told me, there eSata ExpressCard is not using the JMB360 chipset but rather the Sil3132 chipset which I wanted to avoid. In fact, when I talked to the guy, he did not know off hand, so he checked the drivers supplied with the card. As […]

Continue reading