I'm creating a table for maintenance records.
In each record, many of the values are simply checkboxes (on the UI).
In the database table for these attributes, is a good way to store the
state of these checkboxes as simple as 0 for false, 1 for true?
-David 6 1519
"wireless" <wi*********@yahoo.com> wrote in message
news:90**************************@posting.google.c om... I'm creating a table for maintenance records.
In each record, many of the values are simply checkboxes (on the UI).
In the database table for these attributes, is a good way to store the state of these checkboxes as simple as 0 for false, 1 for true?
-David
There are two common ways to do this - either use a bit column, or use
something like a char(1) with a check constraint to ensure the values are
T/F or Y/N. The second solution is more portable, if that's a concern.
Simon
Simon Hayes (sq*@hayes.ch) writes: There are two common ways to do this - either use a bit column, or use something like a char(1) with a check constraint to ensure the values are T/F or Y/N. The second solution is more portable, if that's a concern.
On the other hand it is more sensitive to localization issues. We used
to have such columns in our databases, but I think all are gone now. The
values we used where J/N.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
Erland Sommarskog <so****@algonet.se> wrote in message news:<Xn**********************@127.0.0.1>... Simon Hayes (sq*@hayes.ch) writes: There are two common ways to do this - either use a bit column, or use something like a char(1) with a check constraint to ensure the values are T/F or Y/N. The second solution is more portable, if that's a concern.
On the other hand it is more sensitive to localization issues. We used to have such columns in our databases, but I think all are gone now. The values we used where J/N.
That's a good point, although I would guess (very possibly
incorrectly) that many IT people would be familiar with 'True' and
'False' as Boolean values in various programming languages, even if
their own natural language isn't English. Personally, I think a bit is
the most obvious data type for flags, but then that seems to invite a
lecture from Joe Celko...
Simon
"Simon Hayes" <sq*@hayes.ch> wrote in message news:<40**********@news.bluewin.ch>... There are two common ways to do this - either use a bit column, or use something like a char(1) with a check constraint to ensure the values are T/F or Y/N. The second solution is more portable, if that's a concern.
Thanks, I went with the bit method. I've been working on projects
involving Oracle and other databases for the past few months and hope
not to port anything to any of them! I'm content to be back to a SQL
Server db.
-David
Simon Hayes (sq*@hayes.ch) writes: That's a good point, although I would guess (very possibly incorrectly) that many IT people would be familiar with 'True' and 'False' as Boolean values in various programming languages, even if their own natural language isn't English. Personally, I think a bit is the most obvious data type for flags, but then that seems to invite a lecture from Joe Celko...
Already when you give the choice of Y/N and T/F you have give a choice
that can be source for confusion. One of the DBA goes for the former,
another for the latter, guess if developers will mess up.
As for localisation, recall that some of this data may make to a GUI.
That was the case with our J/N, which our Swedish users had no problem to
understand. They might be able to make out Y/N too, but I would guess that
T/F, or even S/F, would leave them completely in the dark.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
>> I'm creating a table for maintenance records. In each record, many
of the values are simply checkboxes (on the UI). <<
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications.
When you convert the *record* on the paper forms into one or more
*rows* in one or more tables in the database, what does the data look
like?
What I have seen is for maintenance databases is that "yes/no" is not
good enough. You need to know temporal information for each task,
like "scheduled time" and "completed time" as minimal data for
computing MTBF and other things. Would you write an accountign system
in which you had flag for "paid/not paid" and leave out the amounts
and dates?
Simple yes/no flags are all too often computed columns that can be
deduced from the other attributes in the database. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Joshua Beall |
last post by:
Hi All,
What is the best way to use a cookie to remember a logged in user? Would
you store the username and password in two separate cookies? Should the
password be plain text? Hashed? Not...
|
by: Bob Bedford |
last post by:
Sorry if I post here, but I don't have access to any valuable mysql ng for
this question, ans since 99% or php programmers deal with mysql, I'm sure
I'll get an answer here.
Look at the...
|
by: Anonieko Ramos |
last post by:
ASP.NET Forms Authentication Best Practices
Dr. Dobb's Journal February 2004
Protecting user information is critical
By Douglas Reilly
Douglas is the author of Designing Microsoft ASP.NET...
|
by: digitalQ |
last post by:
Okay, this should be pretty simple for those of you who have written several
enterprise level web applications:
I'm looking for simple concepts to deal with a client re-posting the same
data...
|
by: |
last post by:
I have an app that retrieves data from an Access database. At the moment I
have the SQL string as a Const in my app. I understand this is not best
practice. I don't want the user to have access to...
|
by: Woody Splawn |
last post by:
I am finding that time after time I have instances where I need to access
information in a variable that is public. At the same time, the books I
read say that one should not use public variables...
|
by: Harley |
last post by:
I am trying to write a personal app to keep a bank balance and
history.
The problem I'm haveing is finding a decent way to store the data on a
pocketpc under .net compact framewok useing vb.net....
|
by: Brett |
last post by:
If I have many hard coded values such as file paths, file names, timeouts,
etc, where is the best place to define them? Meaning, in the case something
needs changing for example, rather than...
|
by: Nick Craig-Wood |
last post by:
Lance Gamet <lance@gamet.comwrote:
I've found
http://docs.python.org/lib/module-ConfigParser.html
To be easy to use and built in. It makes human readable / editable
..ini - like files.
...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |