Hi @Rock Hitman ,
Please check:
ALTER PROCEDURE [dbo].[usp_GeicoData_Select]
(@Year int = NULL,
@Poll int)
AS
begin
if @Poll=1
begin
Select [ID],[VIN],[Make],[Model],[Year] FROM [TEST].[dbo].[Ins_Data] Where id<=10 and [Year] = @Year ORDER BY [ID]
end
else if @Poll=2
begin
Select [ID],[VIN],[Make],[Model],[Year] FROM [TEST].[dbo].[Ins_Data] Where 10<id<=20 and [Year] = @Year ORDER BY [ID]
end
else
begin
Select [ID],[VIN],[Make],[Model],[Year] FROM [TEST].[dbo].[Ins_Data] Where 20<id<=30 and [Year] = @Year ORDER BY [ID]
end
end
execute [dbo].[usp_GeicoData_Select] @Poll=1
If you have any question, please feel free to let me know.
If the response is helpful, please click "Accept Answer" and upvote it.
Best Regards
Echo