3

The table was created as a NODE, therefore SQL Server adds a graph_id_xxxxxx column between others. I create a view with the following sentence:

CREATE VIEW FILE_VIEW1 AS
SELECT
      [NAME]
FROM [dbo].[FILE_NAME]

But when I see the columns in the view, the graph_id_xxxx column is still there even when it was not part of the select statement in the view.

Would appreciate any help.

Thom A
  • 88,727
  • 11
  • 45
  • 75

1 Answers1

1

While those columns appear in sys.columns (not sure why) for the view, they aren't accessable and don't appear when you select * from the view.

CREATE TABLE Person (ID INTEGER PRIMARY KEY, Name VARCHAR(100), Age INT) AS NODE;
CREATE TABLE friends (StartDate date) AS EDGE;
go
create view vPerson as select Name from Person
go
select * from Person 
select * from vPerson

You can eliminate them from the view metadata by pushing the graph table query into a subquery expression in the view, eg

create or alter view [dbo].[vPerson] as 
with q as (select Name from Person)
select * from q
David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67