Error Creating SQL Server Spatial View

3565
3
Jump to solution
07-09-2014 05:40 AM
JustinRay1
Occasional Contributor

Hi,

I seem to be having difficulty creating a spatial view in SQL Server.  The format I use is basically identical to the example in the Help, but I am getting this error:

Msg 102, Level 15, State 1, Procedure spvw_TEST, Line 2

Incorrect syntax near ','.

Does anyone know why it would be complaining about a comma (it is the first comma after "vw.FieldID" below)?  Here is an abbreviated version of the code I am trying to run:

CREATE VIEW spvw_TEST

AS SELECT (vw.FieldID,vw.Field1,vw.Field2,fc.Shape)

FROM vw_AllMain vw JOIN FeatsDistrib fc

ON vw.txtFeatID = fc.txtFeatID

Thanks,

Justin

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ChristianWells
Esri Regular Contributor

In this case, I believe that it has a problem with the parentheses. In this case, SQL Server is expecting an expression or subquery where the field names are. I was able to successfully run this query by first removing the parentheses. Can you try removing the parentheses and running it again?

CREATE VIEW spvw_TEST

AS SELECT vw.FieldID,vw.Field1,vw.Field2,fc.Shape

FROM vw_AllMain vw JOIN FeatsDistrib fc

ON vw.txtFeatID = fc.txtFeatID

View solution in original post

3 Replies
ChristianWells
Esri Regular Contributor

In this case, I believe that it has a problem with the parentheses. In this case, SQL Server is expecting an expression or subquery where the field names are. I was able to successfully run this query by first removing the parentheses. Can you try removing the parentheses and running it again?

CREATE VIEW spvw_TEST

AS SELECT vw.FieldID,vw.Field1,vw.Field2,fc.Shape

FROM vw_AllMain vw JOIN FeatsDistrib fc

ON vw.txtFeatID = fc.txtFeatID

JustinRay1
Occasional Contributor

Well that worked like a charm; thanks!

I guess ESRI should consider revising their Help section here: ArcGIS Help (10.2, 10.2.1, and 10.2.2)

ChristianWells
Esri Regular Contributor

Glad that I could help. I just submitted a ticket for that document to be reviewed.

0 Kudos