Thursday, July 31, 2014

Problem of Uncertain no. of columns

I think you can have a parameter of a number of columns in your procedure.



CREATE PROCEDURE uspProcedure
@param1 int,
@param2 int,
@numberOfColumns int
AS
IF @numberOfColumns = 1
begin
SELECT @param1
end
IF @numberOfColumns = 2
SELECT @param1,@param2


No comments:

Post a Comment