No data in database view of versioned feature class

583
4
08-29-2019 01:29 PM
ChrisWiebke
Occasional Contributor

If I have a view of versioned data how do i get the view to return data before the feature class it references is reconciled with the default version of the geodatabase?

0 Kudos
4 Replies
George_Thompson
Esri Frequent Contributor

You need to be set the version that you want to see in the view; Read versioned data in SQL Server using versioned views—Help | ArcGIS Desktop 

That should get you what you want.

--- George T.
0 Kudos
ChrisWiebke
Occasional Contributor

I am able to do that in a ssms query window, but the view I created always reads from default.  I would like to be able to specify which version of the geodatabase the view reads from.  Thanks.

0 Kudos
George_Thompson
Esri Frequent Contributor

You need to create a view in SSMS and put that SQL to change the version in the view.

--- George T.
0 Kudos
ChrisWiebke
Occasional Contributor

I used this to create the view:

USE [Our Database]
GO

EXEC database.sde.set_current_version 'the version'

/****** view info******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

but when I script out the view to a new query window, the exec is not there:

USE [Our Database]
GO

/****** view info******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

is there something else I need to do?

Thanks.

0 Kudos