Just adding my vote to the "good question" list. I'm well aware of data type conversions, and spotted the "trick", and still got it wrong through a moment of fuzzy thinking. Well done on re-highlighting the issue.
I think the "trap" is that the code "looks" like it is writing dynamic sql, but it really isn't.
Although I'm irritated that the flipping of 1 and 2 was very noticeable and having noticed it I decided that was "the trick" and thought no more (thus getting the wrong answer) I still thionk it's a good question. It's very important when desk-checking someone's code or trying to debug something to do it carefully and follow through on the whole thing, not stop thinking when you spot something odd, so questions like this are valuable - they remind us that leaping to conclusions without considering all the code is a stupid thing to do.
Tom
Excellent question - which I got right due to having been buitten by exactly this problem in the past, and it took ages to track down the cause
Thanks for the question.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Thanks for posting this.
I am new to SQL server programming. Though both question and answer was clear i would like to know the reason or why SQL server is performing CONVERT_IMPLICIT(datetime,[Union1007],0).(ie why String1, String2 is converted to datetime).
Thanks
Gopinath Srirangan (11/25/2010)
Thanks for posting this.I am new to SQL server programming. Though both question and answer was clear i would like to know the reason or why SQL server is performing CONVERT_IMPLICIT(datetime,[Union1007],0).(ie why String1, String2 is converted to datetime).
Thanks
Please see this post for an explanation : http://www.sqlservercentral.com/Forums/FindPost1021495.aspx
MM
select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);
Viewing 14 posts - 31 through 44 (of 44 total)
You must be logged in to reply to this topic. Login to reply