Stored Procedure Properties
Name | Value |
---|---|
Owner | dbo |
Created | 2004-05-31 |
Startup | False |
Encrypted | False |
Creation Options
Name | Value |
---|---|
QUOTED_IDENTIFIER | OFF |
ANSI_NULLS | ON |
Parameters
Name | DataType | Length | Type |
---|---|---|---|
@PostID | int | 4 | INPUT |
Total: 1 parameter(s)
SQL
SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO CREATE PROCEDURE forums_GetTrackingEmailsForThread ( @PostID int ) AS -- First get the threadID of the Post DECLARE @ThreadID int DECLARE @UserName nvarchar(50) SELECT @ThreadID = ThreadID, @UserName = Username FROM Posts (nolock) WHERE PostID = @PostID -- now, get all of the emails of the users who are tracking this thread SELECT Email FROM Users U (nolock), ThreadTrackings T WHERE U.Username = T.Username AND T.ThreadID = @ThreadID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO