473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

How can I create a YES/NO column?

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?
Jul 19 '05 #1
3 1191
"michaaal" wrote ...
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
Jul 19 '05 #2
> 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' ...
Jul 19 '05 #3
"Aaron [SQL Server MVP]" wrote ...
And if it's char(1), may as well be 'Y'/'N' or 'T'/'F' ...


aye, I should have mentioned that....thanks for the pick-up Aaron ;o)

Regards

Rob
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: js | last post by:
I am trying to create a primary key constraint on a view in the following statement. However, I got an error ORA-00907: missing right parenthesis. If the CONSTRAINT clause is removed, then the...
4
by: Thomas Jerkins | last post by:
When I write a create table SQL statement I want to add some information about the column heading of each column. How does the exact syntax for the create table look like (which includes this column...
0
by: Guy Deprez | last post by:
Hi, i'm having a problem to create indexes. STEP 1 ----------- Connection is OK (you can find the string at the end of the message) Table ("Couleurs") creation is OK STEP 2. Index Creation
1
by: Not Me | last post by:
Hi, I'm sure this is a common problem.. to create a single field from a whole column, where each row would be separated by a comma. I can do this for a specified table, and column.. and I've...
10
by: Zack Sessions | last post by:
Has anyone tried to create a SQL7 view using the CREATE VIEW command and ADO.NET? If so, is there a trick in trapping a SQL error when trying to create the view? I have a VB.NET app that, amoung...
1
by: Dale Williams | last post by:
Everyone: Using C#, I'm trying to create a datagrid on a winform programatically. I placed the datagrid and the form and named it CHGrid. Here's the code I'm using: // Get and bind the data....
2
by: Curtiosity | last post by:
I have done a create or replace view called creditcard1. If I do a "select * from creditcard1" it retrieves the data just fine. If I try to do a statement where I am listing the column names it...
2
by: lakuma | last post by:
Hi, I have a table called A (say) with columns called name, place, animal and thing. I would want to write an on insert trigger on this table, which would create a table with the name of the...
13
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I want to create a new column in a datatable from two existing columns. I have no problem to create the new column using the datatable.columns.add method. The problem is the value of the new...
1
by: Sebarry | last post by:
Hi, I use the following code to create a couple of input fields at run-time. It works fine in Firefox but it doesn't do anything in Internet Explorer and no errors are given. The DOM created...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.