Reputation: 302
I have optimised a stored procedure and created as new one. i want to test the new and old one whether both are pulling same data ie. i wanted to do some automated testing.
Anyone please help on this
Upvotes: 2
Views: 202
Reputation: 257
I don't quite understand your question,but in sqlserver has Audit
&Execution Plan
maybe solve auto do tasks,you can try
Upvotes: 1
Reputation: 1938
You can achieve this by using in-memory tables.
Let's say you have a stored procedure named getUsers
which will give you the list of all the users. The result set contains the fields: Id
, Name
,Username
. Now you can save the result set returned by this stored procedure in an in-memory table, do the same for another stored procedure in an another in-memory table and then compare these two tables.
How can I save the result set of a stored procedure?
Here's how you do it:
declare @MyTable table (Id int, [Name] varchar(50), [Username] varchar(50));
insert into @MyTable
exec getUsers
Do the same thing for the other stored procedure, then compare the result sets returned.
Upvotes: 2