Viewing 15 posts - 16 through 30 (of 1,469 total)
It's a bit long-winded, but this is what I came up with
DECLARE @TestData table (id int, dateVal varchar(12));
INSERT INTO @TestData ( id, dateVal )
VALUES ( 1, '00:02:03:123'...
June 11, 2025 at 10:25 am
You need to first cast the string to a format that is recognisable to SQL
Something like this
DECLARE @SourceTable table (ANNOUNCE_DATETIME varchar(50));
INSERT INTO @SourceTable (ANNOUNCE_DATETIME)
VALUES ( '"20180919T201400+0000"' )
...
June 4, 2025 at 5:54 am
Try something along these lines ...
WITH cteDiff (
SELECT A, C, D, E
FROM [Database].dbo.[Table]
WHERE B ...
June 3, 2025 at 5:51 am
Try something like this
if object_id('tempdb..#temp') is not null
drop table #temp;
GO
create table #temp
(
date datetime,
category varchar(3),
... April 9, 2025 at 3:09 pm
Be careful with global temp tables.
Multiple SPIDs could end up tripping over each other, as they can all see the global temp table.
April 9, 2025 at 2:45 pm
Try something like this ...
DECLARE @RowToDelete int,@Result int;
SET @RowToDelete=1;
DELETE from table where Id=@RowToDelete;
SELECT @Result = @@ROWCOUNT;
IF @Result=1 --- Or whatever rusults is
...
April 6, 2025 at 4:56 pm
Something like this ...
WITH cteWindows AS (
SELECT c.MonthStart
, windowStart = DATEADD(mm, -2, c.MonthStart)
...
February 28, 2025 at 2:55 pm
Something like this ...
DECLARE @StartOfCurrentWindow date = '2024-10-01';
DECLARE @StartOfNextWindow date = DATEADD(MONTH, 3, @StartOfCurrentWindow);
WITH cteBase AS (
SELECT c.MonthStart
...
February 28, 2025 at 1:08 pm
Congratulations @jeff-moden Finally overtook the high priestess on the SSC overall leaderboard.
She did have a shedload of LIKEs. The "upgrade" on the site years ago hasn't helped much...
February 20, 2025 at 5:26 am
Congratulations @jeff-moden
Finally overtook the high priestess on the SSC overall leaderboard.
February 19, 2025 at 9:00 am
Come on @Jeff-Moden. One more post ....
February 17, 2025 at 1:20 pm
SELECT DISTINCT tp.client_id AS Member_ID
, tp.PaidDate AS Paid_Date
, tp.DOS
FROM #ins_temp tp
WHERE (@dateChoice = 'Paid_Date' and tp.PaidDate...
January 24, 2025 at 9:51 am
You could use dynamic SQL
DECLARE @SQL nvarchar(MAX);
SELECT @SQL = N'
SELECT DISTINCT
Member_ID = tp.client_id
...
January 24, 2025 at 6:09 am
This is a similar query that might perform differently. You need to test
SELECT i.ItemID
, i.ItemName
...
January 22, 2025 at 11:52 am
It is difficult to design any queries without knowing anything about your tables and their indexes.
That said, this might help.
SELECT i.ItemID
, i.ItemName
...
January 22, 2025 at 11:44 am
Viewing 15 posts - 16 through 30 (of 1,469 total)