﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Carlo Romagnano  / Unary &amp;amp; Aliases / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 23:59:56 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Interesting question and took quite sometime to figure out and also learnt along the way.Thank you.</description><pubDate>Fri, 02 Mar 2012 15:06:02 GMT</pubDate><dc:creator>zymos</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Carlo - absolutely that is confusing. When I [i]intend[/i] to alias the column, I prefer to use [ColumnName] = col1 syntax, which aligns all my column names nicely. The problem arises when I lose the comma by accident, and SQL turns col2 into an alias for col1, thus messing up my output.</description><pubDate>Wed, 14 Sep 2011 12:36:23 GMT</pubDate><dc:creator>Olga B</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>[quote][b]Olga B (9/13/2011)[/b][hr]Ah yes, my "favorite" bit of SQL syntax [code="sql"]select 0 [A][/code]A fun bug to find when I accidentally delete a comma and then try to figure out what's wrong with the output of[code="sql"]select col1       col2,        col1003from sometable[/code]What? I can't be the only one!:ermm:Thanks for the question![/quote]My favorite syntax is [code="sql"]select col1 AS [newcolname/sometime user friendly col name]from sometable[/code]Other syntax is less readable and as you wrote it may lead to unwanted bug. But maybe very usefull for code generators.</description><pubDate>Wed, 14 Sep 2011 01:56:57 GMT</pubDate><dc:creator>Carlo Romagnano</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>[quote][b]Tom.Thomson (9/13/2011)[/b][hr]Amusing and fairly easy question.The misprints in the explanation may have left some people confused.  All three alias forms are wrong (1st missing "= &amp;lt;", second and third bpth missing "alias").edit:  I can make typos too.  Fixed.[/quote]Unfortunately, the editor to contribute with a question, sometime, changes the text both in the question and more often in the explanation. The explanation was victim of this change. I think because of GREAT and LESS sign that are misinterpreted as html syntax.</description><pubDate>Wed, 14 Sep 2011 01:41:05 GMT</pubDate><dc:creator>Carlo Romagnano</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Good puzzler - thanks. Nice coverage of different scenarios.</description><pubDate>Tue, 13 Sep 2011 16:45:27 GMT</pubDate><dc:creator>matt.bowler</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Amusing and fairly easy question.The misprints in the explanation may have left some people confused.  All three alias forms are wrong (1st missing "= &amp;lt;", second and third bpth missing "alias").edit:  I can make typos too.  Fixed.</description><pubDate>Tue, 13 Sep 2011 16:30:31 GMT</pubDate><dc:creator>L' Eomot Inversé</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Ah yes, my "favorite" bit of SQL syntax [code="sql"]select 0 [A][/code]A fun bug to find when I accidentally delete a comma and then try to figure out what's wrong with the output of[code="sql"]select col1       col2,        col1003from sometable[/code]What? I can't be the only one!:ermm:Thanks for the question!</description><pubDate>Tue, 13 Sep 2011 16:02:41 GMT</pubDate><dc:creator>Olga B</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>It's a nice and interesting question. Thanks.</description><pubDate>Tue, 13 Sep 2011 14:56:05 GMT</pubDate><dc:creator>CoolCodeShare</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Nice question.</description><pubDate>Tue, 13 Sep 2011 13:21:01 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>My first opinion was: very exotic question far away from practical usage.But later I changed my minds. Never thought about arithmetical operations in T-SQl work in such way.  Thanks a lot.</description><pubDate>Tue, 13 Sep 2011 13:00:46 GMT</pubDate><dc:creator>Artur Komkov</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>I think I may need eye glasses, I really had to look hard at the commas to differentiate them from periods... I almost chose the Incorrect Syntax error.</description><pubDate>Tue, 13 Sep 2011 11:40:34 GMT</pubDate><dc:creator>charles evans</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Excellent question - thank you!</description><pubDate>Tue, 13 Sep 2011 08:36:38 GMT</pubDate><dc:creator>Revenant</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Interesting stuff. Thanks for the question.</description><pubDate>Tue, 13 Sep 2011 08:09:11 GMT</pubDate><dc:creator>KWymore</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>good and easy question!</description><pubDate>Tue, 13 Sep 2011 06:36:58 GMT</pubDate><dc:creator>rfr.ferrari</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Thanks for an interesting question.  I got the right answer but not by thinking it all the way through so I learned something new - always a good way to start the morning!</description><pubDate>Tue, 13 Sep 2011 06:07:33 GMT</pubDate><dc:creator>Ernie Schlangen</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>I'm hoping by this afternoon I will have read the explanation enough times to understand it, because I sure as heck don't at this hour of the morning! ;-)ron</description><pubDate>Tue, 13 Sep 2011 05:52:25 GMT</pubDate><dc:creator>ronmoses</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Good question. I admit I had to run it to get the correct answer. Just couldn't visaulize it in my head.</description><pubDate>Tue, 13 Sep 2011 05:45:17 GMT</pubDate><dc:creator>Britt Cluff</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Nice question Carlo! My first thought was, "What am I supposed to learn from this question?" Then I dug in a little deeper. Got it right, but not as quickly as I might have. I still haven't learned to read the title for help. I still have the "Look at the shiny object ..." reaction when I follow the link to the question.</description><pubDate>Tue, 13 Sep 2011 05:33:48 GMT</pubDate><dc:creator>Thomas Abraham</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Nice question, But i got it wrong.</description><pubDate>Tue, 13 Sep 2011 05:17:00 GMT</pubDate><dc:creator>Danny Ocean</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Thank you for the question.Had to think this one through because of the operators.And the variable was just to mess with us? :-PBest regards,</description><pubDate>Tue, 13 Sep 2011 05:02:58 GMT</pubDate><dc:creator>codebyo</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Thanks for the question.I got it wrong, and learned something!</description><pubDate>Tue, 13 Sep 2011 02:49:49 GMT</pubDate><dc:creator>Håvard</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Interesting questionThanks</description><pubDate>Tue, 13 Sep 2011 02:13:43 GMT</pubDate><dc:creator>Stewart "Arturius" Campbell</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Thanks for the question.:)</description><pubDate>Tue, 13 Sep 2011 02:02:47 GMT</pubDate><dc:creator>khelloufsofiane 6183</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Thank you for the question, regards,Iulian</description><pubDate>Tue, 13 Sep 2011 01:16:33 GMT</pubDate><dc:creator>Iulian -207023</dc:creator></item><item><title>RE: Unary &amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Pretty easy question, if you eliminate incorrect answers.@b is never used, so the first and the last answer were impossible.I knew there wasn't any incorrect syntax with the aliases, so the second answer was also incorrect. So that leaves us only with the arrays of numbers.However, as the B column always returns 1, it was pretty easy to deduce the correct answer.Nonetheless, great question which incorporated various scenarios. Thanks.</description><pubDate>Tue, 13 Sep 2011 00:23:36 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>Unary &amp;amp; Aliases</title><link>http://www.sqlservercentral.com/Forums/Topic1173879-1299-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/questions/T-SQL/75622/"&gt;Unary &amp;amp; Aliases&lt;/A&gt;[/B]</description><pubDate>Mon, 12 Sep 2011 21:45:12 GMT</pubDate><dc:creator>Carlo Romagnano</dc:creator></item></channel></rss>