I have a stored procedure with a username parameter. I want to use one query to grab a userid, then use this variable in further queries.
Here's what I have so far. It compiles OK, but on execution I get an error "Error converting data type varchar to uniqueidentifier."
ALTER PROCEDURE [dbo].[sp_User_delete]
@username uniqueidentifier
AS
BEGIN
SET NOCOUNT ON;
DECLARE @UserId uniqueidentifier;
-- I guess I need to do something here to convert the ID
SET @UserId =
(SELECT UserId FROM aspnet_Users WHERE UserName=@username);
SELECT * FROM dbo.aspnet_UsersInRoles WHERE UserId=@UserId;
END