| Return To Topics |
Originally Posted: 6/6/2006 8:10:24 PM |
| |
Last Updated: 6/6/2006 8:10:24 PM |
Subject:
Help Trying To Write Portable SQL
You Asked....
I am creating a table called 'Company' and want to use a column called 'Active' that is basically set to 0 when the entity is 'Active' and 1 when the entity is 'Inactive'.
In trying to make my DDL as portable as possible which data type should be used for the 'Active column?
and we responded....
There are two schools of thought on this one.
Some would say define the column using CHAR because it is more widely supported across RDMS's. Some also believe that using CHAR allows for a less ambiguous meaning.
There other school of thought is to use INT because making your DDL portable across RDMS's is virtually impossible because each has a slight variation.
Hope that helps.
Review By: joblock
>>>>>Begin Original Message<<<<<
I am creating a table called 'Company' and want to use a column called 'Active' that is basically set to 0 when the entity is 'Active' and 1 when the entity is 'Inactive'.
In trying to make my DDL as portable as possible which data type should be used for the 'Active column?
>>>>>End Original Message<<<<<
If your using 1's and 0's those are integers. However, if you want to make sure 0 is false and 1 is true, us -1 as true and 0 as false. That way you can cast it to bolean, and use very efficient functions in oracle as sql server. It should depend on how you use the data. What logic do you have to perform to present the data to the UI. Minimize that logic.
Review On: 7/10/2006 4:21:33 PM
|