Prev: "pivoting" when the column selectors are inequalities?
Next: converting number to string in hex
From: Justin D. on 26 Jul 2010 18:35 Hi I am trying to display as '1' at the Reporting Service, but it keeps coming out as 'True.' Is there anyway I could display as number - '1' ? When I do a query from MS SQL Server Mgmt Studio 2005, it displays as '1' but when the same sp runs from the Reporting Service, it displays as 'True'. Any comments would be appreciated. Thanks. Justin
From: Plamen Ratchev on 26 Jul 2010 22:08 Cast the column to INT, like CAST(bit_column AS INT), and see if it does the trick. -- Plamen Ratchev http://www.SQLStudio.com
From: Justin D. on 27 Jul 2010 17:55 Thanks. "Plamen Ratchev" wrote: > Cast the column to INT, like CAST(bit_column AS INT), and see if it > does the trick. > > -- > Plamen Ratchev > http://www.SQLStudio.com > > . >
From: --CELKO-- on 27 Jul 2010 18:38 It is a good idea to avoid BIT. First it was a bit in the usual sense of {0,1}, then it became a numeric data type, with {0, 1, NULL}. Programmers who are still stuck with an assembly language mindset try to map it to {TRUE, FALSE} but some languages (VB and C# among many) show TRUE with an internal -1 and others use +1. You already ran into another inconsistency yourself. Unlike assembly languages, COBOL and older procedural languages, SQL is a "predicate language" that finds the status of the data with expressions rather than by looking for flags set by the previous steps in a sequential process.
From: Wes Groleau on 27 Jul 2010 20:00 On 07-27-2010 18:38, --CELKO-- wrote: > Programmers who are still stuck with an assembly language mindset try > to map it to {TRUE, FALSE} but some languages (VB and C# among many) > show TRUE with an internal -1 and others use +1. You already ran into And some languages actually support abstraction and expect you to think of a boolean as either true or false and never numeric. SQL is pretty good in general for abstraction, but it would be nice if it had an actual boolean type instead of one that you can't use unless you can remember what number(s) are used for each value. The ability to have {true, false, undefined} instead of only {true, false} is another benefit. -- Wes Groleau People would have more leisure time if it weren't for all the leisure-time activities that use it up. -- Peg Bracken
|
Next
|
Last
Pages: 1 2 Prev: "pivoting" when the column selectors are inequalities? Next: converting number to string in hex |