Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my code:

SQL
SELECT *
FROM [Lab51].[dbo].[well255s]
WHERE len(API)>3;
SELECT
[AREA],
[SURFACE_ID],
[API],
[LONG],
[LAT],
API as API
SELECT *
FROM [Lab51].[dbo].[karnesOGJoined]
WHERE len(API)>3;
[ID],
[Permit_Number],
[County],
[Lease_Name],
[Operator_Num],
[K_ZIP],
[API],
[Org_Number],
[Org_Name],
[OG_ZIP],
o.API as OG_ZIP
into
[Lab51].[dbo].[alldata],
from dbo.karnesOGJoined o,
dbo.well255s k,
WHERE
[API]=[API];


When I try to execute this query, I get the error, "Incorrect syntax near 'ID'". I'm taking a geodatabases class and am new to using SQL Server. I have SQL Server 2016 and SQL Server Tools 18 installed. Any suggestions?

What I have tried:

I have tried adding code, deleting code, and moving code around. Unfortunately, this doesn't work.
Posted
Updated 1-Jul-19 18:53pm
v2

1 solution

API as API
SELECT *
FROM [Lab51].[dbo].[karnesOGJoined]
WHERE len(API)>3;
[ID],
None of this looks right: you probably need a semicolon after "as API", you probably need a SELECT before [ID], and it all looks generally weird.

I'd strongly suggest you sit down with the table definitions and a list of exactly what you are trying to return and start again from scratch because that looks very like it was thrown together rather than planned...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900