SQL Standards for comment styles
From: Jeff Zucker <jeff_at_vpservices.com>
Date: Fri, 25 Jan 2002 10:54:36 -0800
Message-ID: <3C51A9EC.1A6F426_at_vpservices.com>
Is this a correct assessment of ambiguities in the standards for comment styles? What is the right way to treat this statement and how would it actually be treated in various implementations?
Date: Fri, 25 Jan 2002 10:54:36 -0800
Message-ID: <3C51A9EC.1A6F426_at_vpservices.com>
Is this a correct assessment of ambiguities in the standards for comment styles? What is the right way to treat this statement and how would it actually be treated in various implementations?
Given
SELECT * FROM foo WHERE bar=baz--3+qux
Treating the double minus signs as a minus operation on a negative number, the statement should be evaluated as:
SELECT * FROM foo WHERE bar = baz - -3 + qux
But treating the double minus signs as a comment introducer, it evaluates to:
SELECT * FROM foo WHERE bar = baz
( and the comment "3+qux" )
There is nothing in the standards to differentiate between the two cases.
AFAIK, the double minus style of comment is the only style recognized in SQL92 and it is still valid in SQL93. SQL3 also accepts C-style /* ... */ comments.
-- JeffReceived on Fri Jan 25 2002 - 19:54:36 CET