Viewing 15 posts - 31 through 45 (of 77 total)
Thanks to all for the solutions!
On a quick look, sparked enough ideas for me to try and (hopefully) write a solution - don't want to be beaten by it. I...
October 2, 2020 at 5:08 pm
ZZartin thanks, that works. What if it was 'at least 4 1s' (would need new test data). Ideally the number would be variable, could that be achieved.
October 1, 2020 at 7:57 pm
The @r is just to get into a table what the result should be so that it can be easily read. It will play no part in any solution.
I did...
October 1, 2020 at 6:58 pm
select 'After', NULL, NULL
is not required in the result.
October 1, 2020 at 2:15 pm
Yes, I wasn't arguing for natural over surrogate keys, and tend to have both if possible. An ID for simplicity of joins and a unique index on other column(s). Hope...
August 23, 2020 at 8:04 pm
Only enforcing uniqueness by an identity column PK is my No. 1. Simple, but see it all the time and the disastrous consequences.
August 23, 2020 at 1:08 pm
Yes, order of processing can differ - rare and not something I had seen before.
https://docs.microsoft.com/en-us/sql/t-sql/queries/select-transact-sql?view=sql-server-ver15
Yellow box warning following the section Logical Processing Order of the SELECT statement:
"The preceding sequence is...
February 11, 2020 at 2:38 pm
OK. I ask because I have seen it too, despite the logical ordering of processing that I thought was the last word on it.
https://www.sqlservercentral.com/forums/topic/select-processed-before-where-clause#post-3696457
February 10, 2020 at 4:03 pm
Out of interest - by 'later', are you saying that the CAST/ TRY_CAST is being executed in the SELECT before the WHERE?
February 10, 2020 at 2:49 pm
AND and OR treat UNKNOWN as FALSE, and the result is what I'd expect from the WHERE clause. But this is not the case with NOT and UNKNOWN. To avoid...
November 20, 2019 at 8:32 pm
Yes, when you re-arrange to that - remove the NOT - the result in 3. makes sense.
I find it difficult to see it with the original: not (a = 1...
November 20, 2019 at 4:42 pm
Yes. It's not about the logical order of processing but an exception to it. Specifically, that a conversion in the SELECT can be executed before the WHERE. I came across...
November 9, 2019 at 9:49 am
Can't post code at moment. The change I made to the WHERE clause returns a subset of the rows that were successfully returned previously. But errors on casting a value...
November 6, 2019 at 7:46 pm
Thanks. Will use the ISNULL to eliminate the final operation. Don't really see the need to go any further as it will probably be wrapped up in a scalar-valued function.
March 23, 2016 at 2:53 am
Ended up with this, that is closer to my actual requirement. Previously used a WHILE loop and counter.
declare @List varchar(max) = '123456789'
declare @ChunkSize int = 3
declare @SepChar char(1) = ','
declare...
March 22, 2016 at 2:58 pm
Viewing 15 posts - 31 through 45 (of 77 total)