How can I create a YES/NO column?

M

michaaal

I use this code to dynamically create a column in a table...

strSQL = "CREATE TABLE (FirstName TEXT(30), LastName TEXT(20));"
conn.execute(strSQL)


This will create two text columns. How can I create some YES/NO columns
instead of TEXT columns?
 
R

Rob Meade

...
I use this code to dynamically create a column in a table...

strSQL = "CREATE TABLE (FirstName TEXT(30), LastName TEXT(20));"
conn.execute(strSQL)


This will create two text columns. How can I create some YES/NO columns
instead of TEXT columns?

You haven't mentioned what type of database you are using (Access/SQL Server
etc), however, you could always add a 'bit' or 'char' datatype and give it a
size of 1, then all 1's might be Yes and 0's might be No - you could handle
this within the app.

Regards

Rob
 
A

Aaron [SQL Server MVP]

etc), however, you could always add a 'bit' or 'char' datatype and give it
a
size of 1, then all 1's might be Yes and 0's might be No

And if it's char(1), may as well be 'Y'/'N' or 'T'/'F' ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top