Stored Procedure Query

  • I suppose you're not running this query on a SQL Server 2008.

    I think you're on SQL Server 2005.

    -- Gianluca Sartori

  • Try splitting this line:DECLARE @CategoryId Int =

    (

    SELECT CategoryId

    FROM dbo.[Forums.Categories]

    WHERE ForumId = @ForumId

    AND ParentCategoryId IS NULL

    ); --12;

    into:

    DECLARE @CategoryId Int;

    SELECT @CategoryID = CategoryId

    FROM dbo.[Forums.Categories]

    WHERE ForumId = @ForumId

    AND ParentCategoryId IS NULL;

    And let us know if that helps.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

Viewing 2 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply