Extraction data for javascript

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A about the site for music historians, critics, and fans

-- 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),
    AcceptedAnswerId INT,
);

-- 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;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results