Viewing 15 posts - 331 through 345 (of 753 total)
The WHERE clause has to precede the GROUP BY CLAUSE -- where filters data before it is aggregated
SELECT...
FROM...
JOIN...
WHERE...
GROUP BY...
HAVING...
ORDER BY...
August 3, 2022 at 1:04 pm
Why not use STRING_SPLIT?
The spaces around the slash complicate it slightly since STRING_SPLIT accepts only a single-character delimiter, but as long as the spaces are consistent, you can handle that...
July 28, 2022 at 4:30 pm
I suspect you meant "...relational databases are not going away."?
July 27, 2022 at 6:46 pm
MySQL functions --
DATE_SUB(CURDATE(), INTERVAL 7 DAY)
-- won't be of much use on SQL Server 2019.
July 26, 2022 at 2:19 pm
deleted
July 22, 2022 at 4:12 pm
@P8 -- like all your improbably large/generic parameters -- is an nvarchar(4000). cid can't possibly be nvarchar(4000) and have an index/primary key -- it's too large to be indexed. The...
July 20, 2022 at 1:30 pm
One way would be to have an assignment # column in the association table -- e.g. AssignmentNumber. Use tinyint. And create a check constraint that limits AllocationNumber to 1 through...
July 20, 2022 at 1:05 pm
It generally matters little, if at all -- the optimizer should be able to use statistics to order the predicates optimally.
Far more important are statistics and indexing. Without an appropriate...
July 14, 2022 at 1:38 pm
No: "Scalar functions must be invoked by using at least the two-part name of the function (<schema>.<function>)"
Why are you even trying to work around this? You should preface all...
July 14, 2022 at 1:27 pm
I actually tried it that way prior to the where clause way. It does work, but the update will update all the matched records since there is no filter on...
July 13, 2022 at 3:47 pm
We don't have your fn_GetAlphabetsOnly function -- that's a user-defined function.
The following returns EMA_T__MRNMM_PMSPAT_PID_OR_Dr:
DECLARE @string VARCHAR(255) = 'EMA_20210526T211254_0000_MRNMM0000001240_PMS110460PAT000001287_PID15235307_OR_Dr'
SELECT @string,REPLACE(@string,'%[^0-9]%',''), REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(@string,'0',''),'1',''),'2',''),'3',''),'4',''),'5',''),'6',''),'7',''),'8',''),'9','');
Note: Your sample results don't seem to reflect...
July 12, 2022 at 6:58 pm
Prior post referencing S.O. was flagged as spam?!?, so here's an abridged MSSQL version w/o links:
SELECT [Number], [Cost],
(SELECT Max(v) FROM (VALUES (date1), (date2), (date3)) AS value(v)) as...
July 12, 2022 at 5:42 pm
Is it possible before it complete the backup of the one database it will start another database backup?
SQL Server Agent will not start another instance of a job if job...
July 12, 2022 at 1:13 pm
Viewing 15 posts - 331 through 345 (of 753 total)