Odd TSQL Behavior

SQL Server 2005, SQL Server 2008, SQLServerPedia Syndication, TSQL
Before I describe this, let me thank Lynn Pettis over at SQL Server Central for coming up with the answer. This morning a developer walked up and asked me what would happen if he ran a query that looked like this: [crayon-5a6c5041286f3661751279/] I said that he'd get an error. No, he says, try it. So I try it and I get this: [crayon-5a6c504128700230498971/] Try it yourself. It works just fine. I'd never seen that before and didn't have a clue what it was. Thinking that Microsoft had supplied some new short hand to define aliases I ran this: [crayon-5a6c504128703330722250/] Which resulted in the error:   Msg 258, Level 15, State 1, Line 1 Cannot call methods on varchar.   Which is what I would have expected. I tried a couple…
Read More