JoachimPetersen
asked on
T-SQL: select from array list parameter and return multiple results
Hello, I am trying to parse a array of ID's and then return the results:
The table looks like this:
ID - int (auto identifyer)
FacebookID - bigint
CurrentL - float
CurrentP - float
CurrentU - int
Created - datetime
ALTER PROCEDURE dxf1s_qqq.Getup_GetFriends
-- Add the parameters for the stored procedure here
@FriendListID varchar(max),
@FacebookID bigint OUTPUT,
@CurrentL float OUTPUT,
@CurrentP float OUTPUT,
@CurrentU int OUTPUT,
@Created datetime OUTPUT
AS
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
BEGIN
SELECT @FacebookID = FacebookID, @CurrentL = CurrentL, @CurrentP = CurrentP, @CurrentU = CurrentU, @Created = Created FROM Getup_Log.SplitInts(@FriendListID, ',');
RETURN
END
When I execute it:Running [dxf1s_qqq].[Getup_GetFriends] ( @FriendListID = 3391443009,3391443008, @FacebookID = <DEFAULT>, @CurrentL = <DEFAULT>, @CurrentP = <DEFAULT>, @CurrentU = <DEFAULT>, @Created = <DEFAULT> ).
Procedure or function 'Getup_GetFriends' expects parameter '@FacebookID', which was not supplied.
No rows affected.
(0 row(s) returned)
@FacebookID = <NULL>
@CurrentL = <NULL>
@CurrentP = <NULL>
@CurrentU = <NULL>
@Created = <NULL>
@RETURN_VALUE =
Finished running [dxf1s_qqq].[Getup_GetFriends].
I get null when I execute it, and I do have a data inside my table with these two FacebookID'sThe table looks like this:
ID - int (auto identifyer)
FacebookID - bigint
CurrentL - float
CurrentP - float
CurrentU - int
Created - datetime
ASKER
I execute the stored procedure with Visual Studio Server Explorer (same as SQL management), I only parse the FriendListID array and I set the rest of the values as OUTPUT, do you want me to set the FriendListID as OUTPUT too?
Changing the @FriendListID varchar(max) to @FriendListID varchar(max) OUTPUT did not help, now it just simply only retruns the @FriendListID, the rest of the parameters is not returned.
what I want is simply: parse an array of ID's, select specific fields where the ID's match and retrun it somehow where I can simply manage the return values in asp.net / vb.net
A working example where you parse an array of ID's, select specific fields where the ID's match and retrun the values (the retrun value should be asp .net/ vb.net friendly), I can rewrite it to suit my needs myself.
Changing the @FriendListID varchar(max) to @FriendListID varchar(max) OUTPUT did not help, now it just simply only retruns the @FriendListID, the rest of the parameters is not returned.
what I want is simply: parse an array of ID's, select specific fields where the ID's match and retrun it somehow where I can simply manage the return values in asp.net / vb.net
A working example where you parse an array of ID's, select specific fields where the ID's match and retrun the values (the retrun value should be asp .net/ vb.net friendly), I can rewrite it to suit my needs myself.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Incidentally, this Stored Procedure does not return a result set.