Viewing 15 posts - 1,531 through 1,545 (of 7,614 total)
LTRIM(RTRIM(SUBSTRING(name, CHARINDEX(')', name) + 1, PATINDEX('%[+-][0-9]%', name) - (CHARINDEX(')', name) + 1))))
;WITH test_data AS (
SELECT * FROM ( VALUES('(b) Joe Brown -12563'), ('(a)...
June 7, 2021 at 3:15 pm
It depends. If there's a large volume of data written to your SQL log even when there are no errors, then you should probably switch the logs more often (and,...
June 4, 2021 at 3:32 pm
No directly usable data to test with, but I think this should at least be close:
SELECT PH.*, PA.*
FROM dbo.PolicyHeader PH
OUTER APPLY (
SELECT TOP...
June 4, 2021 at 3:27 pm
Add WITH (TABLOCK) hint after the table name.
Examples:
UPDATE dbo.table_name WITH (TABLOCK)
SET ...
INSERT INTO dbo.table_name WITH (TABLOCK)
SELECT ...
June 4, 2021 at 3:00 pm
I think you can combine the first two queries into a single query, also avoiding having to rank all the totals:
WITH cteCombined AS
(
SELECT TOP (1) WITH...
June 3, 2021 at 9:10 pm
For the much more straightforward approach:
SELECT DISTINCT N
vs
SELECT N
...
GROUP BY N
my machine shows a slight edge for DISTINCT. That's what I've seen in normal usage, too. For a straight list...
June 3, 2021 at 4:01 pm
No, it's not a row total, as Steve noted. It's the number of seek operations since the stats for that index were created.
One query that reads, say 5,000 rows, might...
June 3, 2021 at 3:09 pm
Well, good luck. Since your posts seem to disagree with themselves, I don't think I can be of any more assistance.
"we are getting emails of large queries taking longer than...
June 2, 2021 at 2:31 pm
Hmm, do you have tables under different schema names? Is it possible that dbo.same_table_name is empty, but some_other_schema.same_table_name has rows?
June 2, 2021 at 12:49 pm
What is the "cost threshold for parallelism" setting? If it's lower than, say, 50, you should seriously consider changing it.
Did you verify there are no physical issues -- controllers, NIC/communication...
June 2, 2021 at 12:47 pm
Hi guys, I have found this resource for interview preparation https://artoftesting.com/sql-queries-for-interview
Lordy... not another one... 🙁 Jumping straight to the final two questions in the "experienced" section...
Without loading it...
June 1, 2021 at 6:55 pm
That's too much for a single q here. You need to break this into separate qs, each with a single and specific q.
May 30, 2021 at 5:51 pm
Your "first attempt" looks remarkably similar to the code I posted on an almost identical q of yours:
https://www.sqlservercentral.com/forums/topic/printing-the-highest-count#post-3889964
May 30, 2021 at 5:49 pm
You can use a subquery, but you don't technically need it. If branches tie and you want to list all tied branches, change to "TOP (1) WITH TIES".
May 30, 2021 at 5:50 am
Viewing 15 posts - 1,531 through 1,545 (of 7,614 total)