Wednesday, February 25, 2009

Data Type and it's Danger

I was working in a finance application. Recently we discovered the simple mistakes done the datatype and its dangerous implications.

1. Temp table column data type
We had a report SP which has temp tables. The data type of temp tables are set exactly matching to the base column. But when the report is executed it gets the consolidate values, so the data lost is happening.

In the latest stage of the project we have change the data from INT to GUID, which lead to break the existing codes. We need to have a special consideration for GUID data type.

When declaring the VARCHAR it is mandate to specify size of the VARCHAR other it will be defaulted to 1 and data lost will happen.

Whenever you data has multi language characters we must use NVARCHAR, if you use VARCHAR the charters are set o ?.

No comments:

Post a Comment

Managing SQL Role

Recently, we had a scenario, where we need a simple SQL Role which gets read access to bunch of views.  While it was easy to create the vie...