I am looking for a sample code in VB or C# to read a versioned feature class in a SDE SQL database table and write in a table in another SQL database.
Using what library/SDK?
Yes using ArcObjects SDK. I am thinking about a console application.
We tried reading directly the FC tabular table in SDE, but when the FC is not compressed, the table in Default does not have all the Delta records. To avoid that it is better to read the FC and save the data in a local table in another SQL server database.
Actually, you can query the data using SQL (you must query the Feature Class' versioned view). Using this method you can even query a specific Geodatabase version.
See links below:
Thank you very much Leonardo,
I knew about versioned views to point to default version, but I a discovering with your link all the options to create and update specific versions.
It is a very helpful link.
I have an additional question! We have a regular ASP.Net Web application that uses the attribute data from one of the versioned feature classes, the SDE Projects FC.
What approach do you recommend for the web application to query this FC data:
Since you're already working with a Geodatabase, I'd probably suggest the first approach. This way every change made in the Feature class will be seen in the view.
Also, with the second approach you will need to run the script every now and then to keep the table updated.