Thursday, July 31, 2014

How to implement poor-man's version control with TSQL queries

You just need a query like below




--You pass usernames through this parameter to get related project details
DECLARE @User varchar(100)
SELECT *
FROM Projects p
WHERE UserName = @User
AND NOT EXISTS (SELECT 1
FROM Projects
WHERE ProjectID = p.ProjectID
AND Version > p.Version)

I'm assuming your table will have fields as below


ProjectID - to indicate a project


Version - to store version info


Username - the user for the project




Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment