Viewing 15 posts - 31 through 45 (of 1,464 total)
You can convert it to a date/datetime with
CONVERT(date, '12/31/24', 1)
December 31, 2024 at 4:44 pm
Correct. However (IT DEPENDS), there are times when a variable will not be updated using ISNULL. That is why it is sometimes necessary to use the other syntax. In the...
December 30, 2024 at 12:23 pm
Either below; the first is more typical:
DECLARE @LATEST_DATE DATE;
SELECT @LATEST_DATE = MAX(MY_DATE) FROM DBO.TABLE
--or:
SET @LATEST_DATE = (SELECT MAX(MY_DATE) FROM DBO.TABLE);
I generally use the 2nd version of...
December 27, 2024 at 5:38 am
I would look at "forcing" the overlap. This can be achieved by applying an extra CTE at the start of the above code
WITH ForcedOverlap AS (
...
December 6, 2024 at 12:46 pm
You dont show your expected output.
Maybe this will point you in the right direction
WITH cteLag AS (
SELECT lt.Number
...
December 4, 2024 at 6:01 am
This code illustrates how AT TIME ZONE automatically caters for DST
DECLARE @Data table (
MyTimeUTC datetime
);
INSERT INTO @Data ( MyTimeUTC )
VALUES ( '2024-05-01 00:31:15' )
...
November 20, 2024 at 6:07 am
I am having difficulty understanding what you are trying to achieve. Maybe some sample data and expected results will help.
That said, I suspect that your design is going to fall...
November 20, 2024 at 5:46 am
Always store your datetimes as UTC
The DB creates the timestamp in UTC
The when selecting,
SELECT LocalTime = TimeFromtable AT TIME ZONE 'UTC' AT TIME ZONE 'your clients timezone'
FROM...
November 19, 2024 at 4:02 pm
This is an alternate piece of code that will match your 2nd attempt
SELECT [IN_1_NOT_IN_2] = s1.SYMBOL
, [IN_2_NOT_IN_1] = s2.SYMBOL
FROM (
...
November 14, 2024 at 6:49 am
You can write this as a cross-tab query
SELECT Q1 = pid
, Q2 = MAX(IIF(mne = 'Q2', mneval, null))
...
November 13, 2024 at 12:59 pm
This is probably Microsoft pushing back to try and force JEFF to move from datetime to datetime2 😉
November 12, 2024 at 7:00 am
It doesnt matter what query you run. The 16 threads are hitting the same table, joining back to itself 8 times. There will always be contention.
Bottom line - The more...
November 11, 2024 at 1:14 pm
If all of the self-joins are needed, some filtered indexes might also help.
As always .... TEST, TEST, TEST
CREATE NONCLUSTERED INDEX ix_Design_Parts_BOMitem
ON design (design, designAlternative, version, class, operation,...
November 8, 2024 at 10:33 am
I would try to push my predicates up as high as possible, then isolate my top-level values, before getting the rest of the data.
Something like this
;WITH cteVersion...
November 8, 2024 at 9:33 am
Viewing 15 posts - 31 through 45 (of 1,464 total)