Solved

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

Posted on 2013-01-10
9
444 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
 
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
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
Viewers will learn how the fundamental information of how to create a table.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now