Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-01-10
9
Medium Priority
?
455 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
[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
  • 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 143

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
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…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

721 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