How to compare two stored procedures

Posted by Kirthiga under Sql Server on 11/20/2012 | Points: 10 | Views : 16388 | Status : [Member] | Replies : 12
How to compare the stored procedure to check if both the one are similar or not.




Responses

Posted by: Saratvaddilli on: 11/20/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Please kindly ask your question in a better way it was an ambiguity to me ,
you want to compare the result set ?

Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kirthiga on: 11/20/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Saratvaddilli,

I dont want to compare the result set. I want to compare different version of stored procedure.
My stored procedure contains four thousand lines of codes. Some changes were made in my stored procedure by others. I want to identify the changes made in new version. Tell any easy method to compare.

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Saratvaddilli on: 11/21/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi Kirthiga
we had an approach
using sys.objects we can get the last modified date and changes done to it
Once try this

SELECT name, create_date, modify_date,type_desc

FROM sys.objects
WHERE type = 'P'
AND name = 'usp_yourSPname' ORDER BY 1 DESC


Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandhyab on: 11/21/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
SELECT name

FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 7

Above one can be used to check recently modified stored procedure. If stored procedure was created but never modified afterwards modified date and create date for that stored procedure are same. Cahnge 7 to any other day value. That List All Stored Procedure Modified in Last N Days.

Thanks & Regards

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kirthiga on: 11/21/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

I dont want the details of modified date.
My question is how to find the changes made in the code. I want to compare the lines of codes of two procedures.

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandhyab on: 11/21/2012 [Member] Starter | Points: 25

Up
0
Down
Then Go through following link
http://www.codeproject.com/Articles/75026/SQL-Server-Stored-Procedures-Comparer

Thanks & Regards

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 11/21/2012 [Member] Starter | Points: 25

Up
0
Down
hi Kirthiga,
we can compare codes in node++.Try this

Thanks & Regards
Hari

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kamprasad2007 on: 11/23/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

User redgate tool for do this.
http://www.red-gate.com/

Best Regards,
kamprasad

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nkkppp on: 11/23/2012 [Member] Starter | Points: 25

Up
0
Down
Use VSS to compare the code.


--Prathap

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Peermohamedmydeen on: 6/6/2013 [Member] Bronze | Points: 25

Up
0
Down
use Beyond Compare tool.

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raj.Trivedi on: 6/6/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello Check this link

http://www.informit.com/guides/content.aspx?g=sqlserver&seqNum=210



http://usefulhowto.blogspot.in/2008/05/sql-server-stored-procedure-compare.html

Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bugwee on: 6/6/2013 [Member] Starter | Points: 25

Up
0
Down
you can save your stored procedure as a txt file or sql file then compare the two files using WINMERGE.

http://winmerge.org/

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response