Stored Procedure Properties
| Name | Value |
|---|---|
| Owner | dbo |
| Created | 2004-05-31 |
| Startup | False |
| Encrypted | False |
Creation Options
| Name | Value |
|---|---|
| QUOTED_IDENTIFIER | OFF |
| ANSI_NULLS | OFF |
Parameters
| Name | DataType | Length | Type |
|---|---|---|---|
| @Pattern1 | nvarchar | 500 | INPUT |
| @ForumID | int | 4 | INPUT |
| @Username | nvarchar | 100 | INPUT |
Total: 3 parameter(s)
SQL
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE forums_GetSearchResultsByText_FTQ (
@Pattern1 nvarchar(250),
@ForumID int,
@Username nvarchar(50)
) AS
IF @@NESTLEVEL > 1 BEGIN
INSERT INTO #SearchResults(PostID)
SELECT PostID
FROM Posts P (nolock)
WHERE
Approved = 1 AND
(
@ForumID = 0 OR
ForumID = @ForumID
) AND
(
P.ForumID NOT IN (SELECT ForumID FROM PrivateForums) OR
P.ForumID IN (SELECT ForumID FROM PrivateForums WHERE RoleName IN (SELECT RoleName FROM UsersInRoles WHERE Username = @Username))
) AND
CONTAINS(Body, @Pattern1)
ORDER BY ThreadDate DESC
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO