Solved

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

Posted on 2013-01-10
9
445 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

912 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

19 Experts available now in Live!

Get 1:1 Help Now