How to extract attributes of all versions from EPDM?

Hi,

I need to extract the attributes of all versions for a documents. For example one documents has 5 versions so I want to get all the 5 versions of attributes.

I have used below SQL query to get all versions of attributes but its giving only specific attributes for each versions. Its not giving the output as mentioned in "Preview" tab.

"select d.FileName, v.VariableName, vv.ValueCache as [Value], dc.ConfigurationName,Cast(vv.RevisionNo as varchar(5)) + '/' + Cast(d.LatestRevisionNo as varchar(5)) as [Version],o.Description as [Type]

from VariableValue vv

inner join Variable v on vv.VariableID = v.VariableID

inner join Documents d on vv.DocumentID = d.DocumentID and d.LatestRevisionNo=vv.RevisionNo

inner join DocumentConfiguration dc on dc.ConfigurationID = vv.ConfigurationID

inner join ObjectType o on d.ObjectTypeID = o.ObjectTypeID

where d.Filename = '43136.SLDASM'and

dc.ConfigurationID=2 order by vv.RevisionNo"

Is there any changes in my query?

Please tell me any API is there to get all versions of attributes?

Thanks in Advance.

SolidworksSolidworks Pdm enterprise Pdm