This sort of thing should work:
CREATE PROCEDURE pr_Prize_Winner
SET NOCOUNT ON;
DECLARE @User_Id INT = (
SELECT TOP 1
JOIN Issue i ON u.User_ID = i.Reporter_ID
i.Date_Submitted BETWEEN DATEADD(DAY, -7, GETDATE()) AND GETDATE()
AND u.HRD_Staff = '0'
ORDER BY NEWID()
INSERT TargetTable(User_Id, First_Name, Last_Name)
SELECT User_Id, First_Name, Last_Name
WHERE User_Id = @User_Id
1) It is best practice to schema-qualify your table and proc names.
2) Using reserved words as column names (User_Id) is not recommended
3) You may want to issue a command to TRUNCATE the target table before running the INSERT.
Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this
If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.
Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.