[dba-SQLServer] SQL Server - Turning comparisons into Booleans

Francisco Tapia fhtapia at gmail.com
Fri May 11 11:10:59 CDT 2007


On 5/8/07, JWColby <jwcolby at colbyconsulting.com> wrote:
>
> Arthur,
>
> >Let's pick it apart tad by tad, beginning with your denigrating use of
> "infamous". This is a "famous" error, not an infamous error. For
> references
> to infamous errors, their numbers are 533 and 601.
>
> I have no way of knowing whether this is a famous error or
> not.  However...
>
> Infamous - ill-famed: having an exceedingly bad reputation; "a notorious
> gangster"; "the tenderloin district was notorious for vice"
>
> How about "f*g useless!!!  Will that do?


first thing... let's just cut it down... to simple syntax... no need to add
the other letters if someone does not understand your profanity I'm sure you
can handle them privately.


"ERROR SOMEWHERE in the vicinity of...."
>
> Oh yea, that fits the word infamous in my book.  It also fits F*G
> useless as far as I am concerned!


It's a syntactical error.. it tells you where it's at... you need to at this
point re-read the expression you've typed in and re-evaluate what you want
here.  The system isn't going to turn around and error out with:

"ERROR, John, you must use blah blah blah to fix this error" NOT even VBA
does this... IF you happen to have a bad reference somewhere you will notice
that sometimes it will even error out doing stupid things such as case
changes or MIN(x) etc... dumb things that are built in to the language. all
because a reference to a non-default library is missing...

EBKAC is equally helpful, and only a tad more insulting.
>
> >Step 2: Why is there no space between the value and the operator? I shall
> assume that it's the fault of the translator.
>
> Perhaps it is because that is the 47th attempt at putting things in and
> taking things out, NONE of which gave me any results other than the
> INFAMOUS
> "Error somewhere in the vicinity of Hudson NC".
>
> >Step 3: lose the "AS" part and run the query and see what happens. You
> probably won't get this far, since Steps 1 and 2 ought to fix the problem,
> but JIC (just in case).
>
> AS is the clause that defines the alias.  You can't lose that.  Even I
> know
> that.


you can, your AS is optional (ha!)... example

SELECT 1 testfieldone, 2 AS testfieldtwo

this generates a list of values 1 and 2 in columns testfieldone and
testfieldtwo, this is acceptable syntax for sql 7, 2000 and 2005.  Though
adding the AS makes it more legible and easier to follow along (btw, good
idea to get into the habit of capitalizing all they default keywords).



>Step 4: when none of the above works, re-do the query in Management Studio.
> Then compare the syntax.
>
> And this is my problem with you Arthur.  If I told you "if that fails,
> just
> rebuild the space shuttle" what would you tell me?  If I told you that in
> EVERY EMAIL what would you tell me?  Such helpful suggestions are so
> useless
> that I would expect you to someday cease and desisted in issuing them.
> Alas....
>
> I tried using Management Studio.  It is vastly different from Access' qbd
> window and requires more than a passing knowledge of the intricacies of
> SQL
> Server's brand of SQL.  If you had been paying attention for the last few
> months you would understand that to be the root of my problem.  I also
> tried
> poking and prodding, and Googling and looking up various phrases in my
> books, trying to solve the problem without assistance.
>
> Not to worry, James Barash actually solved my problem by providing the (or
> a) syntax needed to do comparisons in SQL Server.  I have to guess that it
> took him all of three minutes to type it into an email, and it took me all
> of three minutes to type it in and verify that it works.
>
> Thanks James!


Glad to see your problem has been resolved.


John W. Colby
> Colby Consulting
> www.ColbyConsulting.com
>
> -----Original Message-----
> From: dba-sqlserver-bounces at databaseadvisors.com
> [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur
> Fuller
> Sent: Tuesday, May 08, 2007 1:35 PM
> To: dba-sqlserver at databaseadvisors.com
> Subject: Re: [dba-SQLServer] SQL Server - Turning comparisons into
> Booleans
>
> Let's pick it apart tad by tad, beginning with your denigrating use of
> "infamous". This is a "famous" error, not an infamous error. For
> references
> to infamous errors, their numbers are 533 and 601.
>
> Now. Let's go step by step.AFAIK S2k5 has no issues with square brackets,
> in
> fact I use them frequently, but begin by removing them.
>
> Step 2: Why is there no space between the value and the operator? I shall
> assume that it's the fault of the translator.
>
> Step 3: lose the "AS" part and run the query and see what happens. You
> probably won't get this far, since Steps 1 and 2 ought to fix the problem,
> but JIC (just in case).
>
> Step 4: when none of the above works, re-do the query in Management
> Studio.
> Then compare the syntax.
>
> A,
>
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>


-- 
-Francisco
http://sqlthis.blogspot.com | Tsql and More...



More information about the dba-SQLServer mailing list