Viewing 15 posts - 1,771 through 1,785 (of 8,416 total)
rjdpa2 (8/3/2011)
thanks!! that helps a lot but it also requires me to change the compatibility level of the DB, which i can't really do. is there another alternative?
Sure:
SELECT
...
August 3, 2011 at 11:38 pm
Tom.Thomson (8/3/2011)
Except that quite often it does evaluate the expression - it's extremely inconsistent.
Can't argue with the general sentiments there!
In their defence, I would say that quite a number of...
August 3, 2011 at 10:16 am
OCTom (8/3/2011)
SELECT 'Test' WHERE EXISTS (SELECT LOG(0))
As noted earlier, this returns an error instead of ignoring the select list of the...
August 3, 2011 at 8:26 am
Christian Buettner-167247 (8/3/2011)
If you think these are strange, then what about this one?
SELECT 'Test' WHERE EXISTS (SELECT LOG10(1/0))
🙂
That's my new favourite! :laugh:
August 3, 2011 at 6:45 am
marlon.seton (8/3/2011)
I'm not convinced that EXPRESSION is not executed
More complex subqueries do indeed need to be evaluated to determine if a row is produced or not - it's just subqueries...
August 3, 2011 at 3:52 am
Toreador (8/3/2011)
So if Microsoft are correct to claim that this is by design, then presumably they would acknowledge all the counter-examples provided by SQLkiwi as bugs?
Yes they have:
All fixed in...
August 3, 2011 at 3:45 am
DECLARE @Table TABLE
(
store_idINTEGER NOT NULL,
visit_timeDATETIME NOT NULL,
customer_idINTEGER NOT NULL
)
INSERT @Table
(store_id, visit_time, customer_id)
VALUES
(1, '8/3/2011 8:02PM', 1),
(1, '8/3/2011 8:41PM', 2),
(2, '8/3/2011 8:31PM', 1),
(2, '8/3/2011 9:01PM', 1)
SELECT
pvt.store_id,
[8pm] = pvt.[20],
[9pm] = pvt.[21]
FROM
(
SELECT
store_id,
hr = DATEPART(HOUR,...
August 2, 2011 at 11:59 pm
Sean Lange (8/1/2011)
August 2, 2011 at 11:50 pm
Ninja's_RGR'us (8/2/2011)
The stats will correctly know that 1 and only 1 row or 0) can be returned so that can't possibly be the issue.
Well technically it's not the statistics -...
August 2, 2011 at 11:43 pm
The following pattern can be useful when you can't be sure whether the input string is Unicode or not:
DECLARE @string VARCHAR(100) = ''
DECLARE @string2 NVARCHAR(100) = N''
SELECT DATALENGTH(@string) / ISNULL(NULLIF(DATALENGTH(LEFT(@string,...
August 2, 2011 at 11:35 pm
deepak.a (8/2/2011)
Even for the below statement also
SELECT 'Test' WHERE EXISTS (SELECT SQRT(-1))
Some more:
SELECT 'Test' WHERE EXISTS (SELECT ACOS(PI()))
SELECT 'Test' WHERE EXISTS (SELECT ASIN(PI()))
SELECT 'Test' WHERE EXISTS (SELECT LOG10(0))
August 2, 2011 at 11:13 pm
Good question, but try:
SELECT 'Test' WHERE EXISTS (SELECT LOG(0))
TSQL is not a model of consistency.
August 2, 2011 at 10:42 pm
sjimmo (8/2/2011)
Not looking for empathy, and this is one of those points where we can respectably decline to agree.
Of course. I'm first up to criticize a poor QotD (and...
August 2, 2011 at 8:43 am
Ninja's_RGR'us (8/2/2011)
So what's your #? :w00t:
How would I know? I never call it. 😛
August 2, 2011 at 8:35 am
Stefan Krzywicki (8/2/2011)
Couldn't resist bragging?
🙁
August 2, 2011 at 8:29 am
Viewing 15 posts - 1,771 through 1,785 (of 8,416 total)