Q&A for people interested in conceptual questions about life and challenges in a world where "cognitive" functions can be mimicked in purely digital environment
-- Parameters DECLARE @FromDate DATETIME = '2018-01-01'; DECLARE @ToDate DATETIME = '2022-01-01'; DECLARE @TagName NVARCHAR(255) = 'javascript'; DECLARE @RowCount INT = 1000; -- Adjust the number of rows as needed -- Temp table to store results CREATE TABLE #TempResults ( PostId INT, PostTitle NVARCHAR(MAX), PostText NVARCHAR(MAX), Tags NVARCHAR(MAX), Email NVARCHAR(255) -- Placeholder for email (not available in Stack Exchange Data Explorer) ); -- Insert into the temp table directly using TOP INSERT INTO #TempResults (PostId, PostTitle, PostText, Tags) SELECT TOP (@RowCount) Id AS PostId, Title AS PostTitle, Body AS PostText, Tags FROM Posts WHERE PostTypeId = 1 AND CreationDate BETWEEN @FromDate AND @ToDate AND Tags LIKE '%' + @TagName + '%' ORDER BY CreationDate DESC; -- Select the desired columns SELECT PostId, PostTitle, PostText, Tags FROM #TempResults; -- Drop the temp table DROP TABLE #TempResults;