Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RevEng: SQL Server Provider: Update tables metadata query for SQL Server 2016 #4697

Closed
lajones opened this issue Mar 4, 2016 · 1 comment
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@lajones
Copy link
Contributor

lajones commented Mar 4, 2016

SQL Server 2016 has a concept of a "System-Versioned" table. Each such table, say XYZ, is backed by an XYZ_Archive table. But the XYZ_Archive table does not have a primary key - so we can't generate an EntityType for it. This is correct as that table is automatically filled in by the system, but to avoid warning messages about all of these tables we should exclude them from the metadata query which returns the list of tables.

In SQL Server 2016, there is a new column on sys.tables called temporal_type. If the value for that is 1 then it's a backing table (called a "History Table" by SQL Server). But this column does not exist on earlier versions of SQL Server so we need to do something like:

IF CAST((select serverproperty(‘ProductMajorVersion’)) AS INT) >= 13
BEGIN
-- execute query with WHERE temporal_type <> 1
END
ELSE
BEGIN
-- execute query we have now
END
@lajones
Copy link
Contributor Author

lajones commented Mar 11, 2016

Fix checked in with commit e96af05.

@lajones lajones closed this as completed Mar 11, 2016
@lajones lajones modified the milestones: 1.0.0-rc2, 1.0.0 Mar 11, 2016
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
@ajcvickers ajcvickers modified the milestones: 1.0.0-rc2, 1.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

3 participants