Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««12345

Type conversions and Nulls Expand / Collapse
Author
Message
Posted Wednesday, February 6, 2013 10:07 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 4:08 PM
Points: 3,794, Visits: 1,134
Excellent question, Tom, and even better explanation.

"El" Jerry.

"A watt of Ottawa" - Gerardo Galvan

To better understand your help request, please follow these best practices.
Post #1416627
Posted Wednesday, February 6, 2013 11:08 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 8:55 PM
Points: 4,421, Visits: 3,414
Nice question - thanks, Tom!
Post #1416649
Posted Thursday, February 7, 2013 1:26 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, July 22, 2014 1:45 AM
Points: 2,834, Visits: 3,866
Thanks for the question!

Best Regards,
Chris Büttner
Post #1416859
Posted Monday, February 11, 2013 7:14 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 4:51 PM
Points: 7,097, Visits: 12,597
Rob Schripsema (2/5/2013)
Great question, Tom

I almost wish you had thrown in an option of '2012-04-01 10:00:00.000' to spice up the thinking a bit more. Of course, then I probably would have gotten it wrong....

+1 to that

Nice question.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1418407
Posted Tuesday, February 26, 2013 6:44 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, October 14, 2013 2:15 AM
Points: 32, Visits: 34
Wow, my first really wrong answer. I knew about CASE's type inferral, just forgot. Thanks for the exceptionally good question.
Post #1424061
Posted Wednesday, March 6, 2013 11:12 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 31, 2014 6:40 PM
Points: 2,136, Visits: 868
I got caught by the Null. I work as a Programmer more often than not where some Languages automatically initialise a Variable at declaration time. The ones that don't tend to just leave the Variable with whatever is in its memory location. I would prefer Null as a default in these instances rather than garbage.
Post #1427778
Posted Wednesday, March 6, 2013 11:20 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 4:51 PM
Points: 7,097, Visits: 12,597
David Conn (3/6/2013)
The ones that don't tend to just leave the Variable with whatever is in its memory location.

Yikes, not sure I know (or knew or remember) which might do that. To which were you referring?


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1427781
Posted Wednesday, March 6, 2013 11:29 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 31, 2014 6:40 PM
Points: 2,136, Visits: 868
C. This was my first encounter with uninitialised variables.

When I declare an Integer for example I expect its value to be 0.

At least in T-SQL we can now give a Value on the Declare statement.
Post #1427783
Posted Wednesday, March 6, 2013 11:42 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 4:51 PM
Points: 7,097, Visits: 12,597
David Conn (3/6/2013)
C. This was my first encounter with uninitialised variables.

Thanks. I am pretty sure that aspect of C "fell off my memory queue" a long time ago

At least in T-SQL we can now give a Value on the Declare statement.

I like that too. We didn't have to worry about garbage in an uninitialized variable but that piece always seemed like one of the more obvious gaps in the language. Now that it is there the language feels that much more fluid and aligned with most of the other languages I work with, which is nice.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1427787
Posted Monday, June 10, 2013 2:42 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, November 25, 2013 9:09 AM
Points: 216, Visits: 118
I was considering the value of null. Apparently, I mistakenly thought (null = 0) would return false (not unknown) and then the not operator would change it to True thereby executing the then clause instead of else.

+1
Post #1461776
« Prev Topic | Next Topic »

Add to briefcase «««12345

Permissions Expand / Collapse