Solved

MS SQL: bit-datatype: where can I set the string-values?

Posted on 2013-01-10
9
447 Views
Last Modified: 2013-01-16
Hi

if I make a query with a bit datatype I get the values "true" or "false". In some installation I get "wahr" and "falsch" (german). Where can I set which values I want to get or where can I read the actual set values?
0
Comment
Question by:formi
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 22

Expert Comment

by:Om Prakash
ID: 38762664
Bit is an integer data type that can take a value of 1, 0, or NULL.

The string values TRUE and FALSE can be converted to bit values: TRUE is converted to 1 and FALSE is converted to 0.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 38762693
I presume it's the front-end application's (or OS) "language" setting that determines if the 1/0 is "translated" to true/false or something else.
this cannot be controlled on sql server side.

so, the question resolves to: how do you actually display the values?
0
 

Author Comment

by:formi
ID: 38762719
Thanks for aour suggestions. I have to tell you more where my problem is: I use a tDbGrid-component from TMS-Software where one can use checkboxes in the grid. In the component's columns there is a property CheckTrue and CheckFalse where one can define which string-value refers to 0 or 1. I tried to add '0' and '1' but this doesn't work. One has to define the string-values (in my case "falsch" and "wahr".

@angelIII: the station where the values are displayed in english is also a german OS, maybe the problem is on a multilanguage-OS??
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 38762730
sorry, I don't know that component, so I don't know how to troubleshoot the grid's behavior...
0
 
LVL 41

Expert Comment

by:ralmada
ID: 38762893
have you tried setting DBAdvGrid.Columns[numericfieldindex].CheckBoxField = true

As per the tms manual:

Example:
Assume that an Interbase numeric field stores 1 as true condition and 0 as false condition. We want
to display & edit this field with a checkbox. As the DB field type is ftNumeric, setting
DBAdvGrid.ShowBooleanFields will not show this field as checkboxes. Setting
DBAdvGrid.Columns[numericfieldindex].CheckBoxField = true will show checkboxes and the checked
state of the checkbox is controlled with DBAdvGrid.Columns[numericfieldindex].CheckTrue = ‘1’ and
DBAdvGrid.Columns[numericfieldindex].CheckFalse = ‘0’.

http://www.tmssoftware.com/site/manuals/TMS%20TDBAdvGrid.pdf
0
 

Author Comment

by:formi
ID: 38763482
Yes I did it. The strange behavior is that it works on my pc but not on a customers pc (many grids with checkboxes but only all checkbox in one grid don't work!

Hi

I have multiple tDbAdvGrids with checkboxes with the following settings:

grid.columns[x].CheckboxField := true;
grid.columns[x].CheckFalse := 'falsch';
grid.columns[x].CheckTrue := 'wahr';
grid.columns[x].Editor := edCheckbox;

I ask in the TMS forum and hope I can get some help.
0
 
LVL 41

Expert Comment

by:ralmada
ID: 38763631
grid.columns[x].CheckboxField := true;
grid.columns[x].CheckFalse := 'falsch';
grid.columns[x].CheckTrue := 'wahr';

I think it should be:

grid.columns[x].CheckboxField := true;
grid.columns[x].CheckFalse := '0';
grid.columns[x].CheckTrue := '1';

that way you don't have to worry about the language. Remember that in SQL store 1 for True and 0 for False, regardless on how it is displayed.
0
 

Accepted Solution

by:
formi earned 0 total points
ID: 38766940
Sorry it was my mistake (as usual :-): the datatype was integer and not boolean. oevery thing is ok.

Regards and thanks, Peter
0
 

Author Closing Comment

by:formi
ID: 38781943
found the solution myself (see above)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

786 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