Viewing 15 posts - 586 through 600 (of 7,614 total)
select *,
case when last_bar = 0 or next_to_last_bar = 0 then ''
else SUBSTRING(serialnumber,...
December 14, 2022 at 8:07 pm
I'd be surprised if an index on a computed column ultimately helped the query plan at all. Unless you have a fully covering index, which would likely duplicate most of...
December 14, 2022 at 3:06 pm
Yes, it would. I took:
i want to select from 00:00:00 - 06:00:00
to mean a contiguous range from 00 to 06, but I likely should have used 00 and 05, if...
December 13, 2022 at 7:24 pm
To keep the query on the remote server "sargable", you shouldn't use any function on its columns in the WHERE, so something more like this (I may not have the...
December 13, 2022 at 7:19 pm
Glad it helped! Here's the 2nd version I mentioned: if you don't have more than 2 total dups, this might be easier to use.
--(2)
SELECT ID,
...
December 12, 2022 at 7:06 pm
WHERE DATEPART(HOUR, datetime_column) BETWEEN 0 AND 6
December 12, 2022 at 7:03 pm
If you want the details too, you can either:
(1) join back to the main table to list all rows <or>
(2) list the min, max and count
--(1)
SELECT t1.*
FROM...
December 12, 2022 at 4:06 pm
SELECT ID
FROM #tst
GROUP BY ID
HAVING
MIN(FNAME) <> MAX(FNAME) OR
MIN(LNAME) <> MAX(LNAME) OR
MIN(DOB) <> MAX(DOB)
December 12, 2022 at 4:04 pm
Each location can't be completely separate if email addresses must be unique. You need to replicate the email addresses across all tables, or have a "master" email table that contains...
December 12, 2022 at 3:02 pm
You could also explicitly define ("format") the column as "Text" data type in Excel.
December 8, 2022 at 3:51 pm
Here's a quick way:
DECLARE @JobDomain int
SET @JobDomain = 1
;WITH cte_Type_B AS (
SELECT *
FROM dbo.TestTable
WHERE JobDomain...
December 8, 2022 at 1:09 am
Is the clustered index on the table on BaseID?
December 6, 2022 at 4:01 pm
You can also use:
'20211130 00:00:00.000'
The only special chars you need are in the time, no - no T.
October 25, 2022 at 10:27 pm
I've never heard of anything like that in SQL Server.
October 25, 2022 at 10:23 pm
Part of the QotD is knowing defaults. This was left off, as many people do this and the default is to allow NULLs.
As a good practice, however, I...
October 25, 2022 at 10:19 pm
Viewing 15 posts - 586 through 600 (of 7,614 total)