Viewing 15 posts - 2,671 through 2,685 (of 7,609 total)
I'd say just use > CHAR(0) if you're going to go that route. Btw, wouldn't you have to use >= CHAR(9), just in case only a tab char was there?
October 10, 2019 at 3:10 pm
And that's why I wrote the code the way I did. The other way is somewhat easier to code, but potentially far worse in performance.
The underlying rule is:
Never use a...
October 9, 2019 at 10:17 pm
2) these display strings sort correctly in temporal order. They are not ambiguous.
As I stated, In the real world dates are sometimes given as YYYY-DD-MM for certain regions of the...
October 9, 2019 at 10:07 pm
Actually, the format YYYYMMDD is perfectly acceptable under ISO. I don't know why Celko insists on repeating his false claim over and over about YYYY-MM-DD despite being told that it's...
October 9, 2019 at 8:16 pm
You probably need something like this:
WHERE (AKey LIKE 'AAA%' OR AKey LIKE 'BBB%' OR AKey LIKE 'CCC%' OR AKey LIKE 'DDD%' OR
AKey LIKE...
October 9, 2019 at 8:10 pm
Don't convert a column to a different data type unless you absolutely can't avoid it (sargability and all). For your situation, this should handle both dates and the -1 properly. ...
October 9, 2019 at 4:13 pm
Thanks for the follow up.
Now it's back to the old approach -- you have to go thru the query plan query by query and tune each separately (and perhaps consolidate...
October 9, 2019 at 4:07 pm
There's nothing per se wrong with CREATEing the table using INTO; indeed, it can help prevent future errors when data types changes, for example. But, you don't want to load...
October 8, 2019 at 10:11 pm
Hmm, interesting. With those symptoms, I'd probably first look for a physical reason. Bad RAM, bad NIC, bad local drive, some physical failing on one node vs the other.
October 8, 2019 at 7:24 pm
An inline TVF should perform better, although how much better it's very difficult to estimate. I've done the best I can converting this in a short time, you may need...
October 8, 2019 at 6:35 pm
Another version, trying to do the least prep work possible (although for determining day or month first, the entire staging table may need to be scanned):
--Assumes that...
October 2, 2019 at 6:50 pm
ALTER TABLE dbo.table_name ADD MinuteToHour AS CONVERT(char(5), DATEADD(MINUTE, CONVERT(int,[sun_total]), '19000101'), 108);
September 30, 2019 at 6:46 pm
We're seeing only a partial plan with none of the actual stats and no sql query text. I can't offer any real guidance with such limited info.
September 27, 2019 at 8:46 pm
I don't think going back just 1 row will be accurate, at least as I understand the requirements (which, of course, could be incorrect). For example, assume times of:
12:24; 12:25;...
September 27, 2019 at 7:11 pm
Something along these lines should let you generate the code:
DECLARE @sql nvarchar(max)
;WITH
cte_tally10 AS (
SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) AS numbers(number)
),
cte_tally1000 AS (
...
September 27, 2019 at 6:49 pm
Viewing 15 posts - 2,671 through 2,685 (of 7,609 total)