Will this work for you?
alter procedure GetRecords @Id int , @status varchar(10), @EmpId int, @PageIndex INT = 1, @PageSize INT = 10, @RecordCount INT OUTPUT as begin IF OBJECT_ID('tempdb..#Results') IS NOT NULL DROP TABLE
Or, if you do not want to throw it every time, you should try something like this:
alter procedure GetRecords @Id int , @status varchar(10), @EmpId int, @PageIndex INT = 1, @PageSize INT = 10, @RecordCount INT OUTPUT as begin CREATE TABLE
This will create a table when the script starts running, and will fall at the end. Values ββwill be inserted into this existing table.
source share