Viewing 15 posts - 16 through 30 (of 1,468 total)
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
You could do something like this
SELECT src.AssessmentCode, src.AssessmentDescriptio, m.Mark
FROM YourSchema.YourTable AS src
CROSS JOIN (VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10)) AS m(Mark)
January 22, 2025 at 11:34 am
Viewing 15 posts - 16 through 30 (of 1,468 total)