Solved

SQL Data Type for radio question Yes/No - Please specify text type

Posted on 2012-03-26
12
384 Views
Last Modified: 2012-03-27
In SQL Which Data type I should choose to create those field in SQL

YES ?   No ?? (Same field contactMe) which Data Type ?
Please specify (ContactMeSpecify") which data type ?

And you do you recommand this data type please advice...


Would your give a course?

( ) Yes  () No
please specify: [                           ]


<input type="radio" name="contactMe" id="ContactMeYes" value="Yes">&nbsp;<label for="ContactMeYes">Yes</label>

<input type="radio" name="ContactMe" id="ContactMeNo" value="No">&nbsp;<label for="ContactMeNo">No <br>

(please specify)</label>
<input type="text" name="ContactMeSpecify" id="ContactMeSpecify" value="" maxlength="255" size="30" style="width: 200px;">
0
Comment
Question by:LelloLello
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
12 Comments
 
LVL 9

Accepted Solution

by:
OCDan earned 250 total points
ID: 37767729
Any field that only takes a yes or no response should be set as a BIT field. This takes up the smallest amount of data and is the recommended way to go.
0
 
LVL 34

Assisted Solution

by:Paul MacDonald
Paul MacDonald earned 250 total points
ID: 37767733
Boolean for all single bit binary (yes/no, 1/0, true/false) data.
0
 

Author Comment

by:LelloLello
ID: 37767784
Okay thank you i have a choose a bit type

Should I choose allow nulls ? [  ]

I got that msg.

'volunteers' table
- Unable to modify table.  
ALTER TABLE only allows columns to be added that can contain nulls or have a DEFAULT definition specified. Column 'contactMe' cannot be added to table 'volunteers' because it does not allow nulls and does not specify a DEFAULT definition.

what that mean?
0
More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

 
LVL 9

Expert Comment

by:OCDan
ID: 37767792
I normally wouldn't allow null, and I would set a default value of 0 so that you aren't getting any false positives.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37767804
Unless you need the third state (null), I would establish a default value for the column.

Leaving the default as null would let you know the data had purposely been filled in, but then you have to check for a null value when you read from the column.
0
 

Author Comment

by:LelloLello
ID: 37767828
so should i check the 'allow nulls' checkbox.
0
 

Author Comment

by:LelloLello
ID: 37767841
so in the database i should insert Yes/No ?
0
 

Author Comment

by:LelloLello
ID: 37767844
<cfquery name="logAnnualDues" datasource="#application.datasource#" username="#application.username#" password="#application.password#">
                  INSERT INTO volunteers (user_id, id_number, firstname, lastname, datereg)
                VALUES (
                <cfqueryparam value = "#form.user_id#" CFSQLType = "CF_SQL_INTEGER" />,
                <cfqueryparam value = "#form.id_number#" cfsqltype="CF_SQL_INTEGER" />,
                <cfqueryparam value = "#form.firstname#" CFSQLType = "CF_SQL_VARCHAR" /> ,
                <cfqueryparam value = "#form.lastname#" CFSQLType = "CF_SQL_VARCHAR" /> ,
              '#DateFormat(NOW())#',
                <cfqueryparam value = "#form.contactMe#" cfsqltype="cf_sql_bit" />
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37767847
I wouldn't, unless you need to.  Set it so it has a default value (either true or false, depending on what you're storing).  

If you need to allow nulls, then by all means check the box.
0
 

Author Comment

by:LelloLello
ID: 37767858
i want the user to choosee yes or no.
0
 

Author Comment

by:LelloLello
ID: 37767872
well what i should do if i don't check the 'allow nulls' the SQL doesn't let me save it.  

In column Properties, which data i should change if i don't want to check the box of 'allow nulls.
0
 
LVL 9

Expert Comment

by:OCDan
ID: 37767938
It should let you if you set a default value.The error message stated you must either allow nulls OR enter a default value.

 If the user has to pick one or the other having a default value will not make any difference, but it will let you save it.
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question