|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Access Yes/No field equivalent in Sql ServerHi,
I am building a table in sql server. One of the field is equivalent to Access yes/no field. This will have values Yes or No obtained from a form in Asp page. I am wonering what would be the correct datatype for this field. Thanks. char(1) - "y" or "n"
varchar(3) - "yes" or "no" Show quote "Jack" <J***@discussions.microsoft.com> wrote in message news:EAF7A165-2386-442D-881C-775B3C161473@microsoft.com... > Hi, > I am building a table in sql server. One of the field is equivalent to > Access yes/no field. This will have values Yes or No obtained from a form > in > Asp page. I am wonering what would be the correct datatype for this field. > Thanks. Jack,
You could use a bit datatype with support for 0 or 1 then translate that to Yes or No in code. You could also use a char(3) with a check contraint limiting the valid entries to Yes/No. A default constratint can be added as well for a default of Yes or No when a user does not explicitly enter a value. HTH Jerry Show quote "Jack" <J***@discussions.microsoft.com> wrote in message news:EAF7A165-2386-442D-881C-775B3C161473@microsoft.com... > Hi, > I am building a table in sql server. One of the field is equivalent to > Access yes/no field. This will have values Yes or No obtained from a form > in > Asp page. I am wonering what would be the correct datatype for this field. > Thanks. You may consider using Bit for boolean data type in Presentation layer.
Perayu Show quote "Jack" <J***@discussions.microsoft.com> wrote in message news:EAF7A165-2386-442D-881C-775B3C161473@microsoft.com... > Hi, > I am building a table in sql server. One of the field is equivalent to > Access yes/no field. This will have values Yes or No obtained from a form > in > Asp page. I am wonering what would be the correct datatype for this field. > Thanks. Thanks for all the help from Raymond, Jerry and Perayu. I appreciate it.
Show quote "Perayu" wrote: > You may consider using Bit for boolean data type in Presentation layer. > > Perayu > > "Jack" <J***@discussions.microsoft.com> wrote in message > news:EAF7A165-2386-442D-881C-775B3C161473@microsoft.com... > > Hi, > > I am building a table in sql server. One of the field is equivalent to > > Access yes/no field. This will have values Yes or No obtained from a form > > in > > Asp page. I am wonering what would be the correct datatype for this field. > > Thanks. > > > |
|||||||||||||||||||||||