How can I create a YES/NO column?

Discussion in 'ASP General' started by michaaal, Jul 4, 2004.

  1. michaaal

    michaaal Guest

    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?
    michaaal, Jul 4, 2004
    #1
    1. Advertising

  2. michaaal

    Rob Meade Guest

    "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
    Rob Meade, Jul 5, 2004
    #2
    1. Advertising

  3. > 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' ...
    Aaron [SQL Server MVP], Jul 5, 2004
    #3
  4. michaaal

    Rob Meade Guest

    "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
    Rob Meade, Jul 5, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. teo
    Replies:
    3
    Views:
    516
  2. Gregory Rampton

    Convert an MS Access Yes/No column to a checkbox column in C# datagrid

    Gregory Rampton, Aug 6, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    187
    Gregory Rampton
    Aug 6, 2003
  3. SStory
    Replies:
    7
    Views:
    314
    SStory
    Jun 25, 2004
  4. michaaal
    Replies:
    4
    Views:
    106
    Egbert Nierop \(MVP for IIS\)
    Jul 5, 2004
  5. Jamie Herre
    Replies:
    1
    Views:
    178
    why the lucky stiff
    Jan 7, 2005
Loading...

Share This Page