luisdev
2012-05-29 09:00:30 UTC
The stored procedure below gives me the user id from a table called
user_table. When I EXEC it using
EXEC dbo.spGetAppID @UserID = '586221'
it works perfectly if there is just one record matching the "WHERE
(user_table.data LIKE @UserID)" criteria.
What do I have to do to get it to return all the user_table.id values
if there is more than one record matching the "user_table.data LIKE
@UserID" criteria?
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE dbo.spGetAppID
@UserID nvarchar(10),
@AppID bigint OUTPUT
AS
BEGIN
SET NOCOUNT ON
SELECT @AppID = user_table.id
FROM user_table
WHERE (user_table.data LIKE @UserID)
END
user_table. When I EXEC it using
EXEC dbo.spGetAppID @UserID = '586221'
it works perfectly if there is just one record matching the "WHERE
(user_table.data LIKE @UserID)" criteria.
What do I have to do to get it to return all the user_table.id values
if there is more than one record matching the "user_table.data LIKE
@UserID" criteria?
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE dbo.spGetAppID
@UserID nvarchar(10),
@AppID bigint OUTPUT
AS
BEGIN
SET NOCOUNT ON
SELECT @AppID = user_table.id
FROM user_table
WHERE (user_table.data LIKE @UserID)
END