SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL query to pull data from AS400 help please
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Tomsriv
Starting Member

USA
5 Posts

Posted - 01/31/2013 :  12:53:08  Show Profile  Reply with Quote
Greetings all,
I am trying to pull and join some fields from an AS400 database into another program that will create points and a table. First off, I want to know if their is a problem in my syntax. From what I have read this is how to use select, but something isn't working. I get errors like "Keyword SELECT not expected." Can anyone help me troubleshoot?

select abaucd as LocID, abbdnb, abbenb from htedta.lmabrep
select utmtr as SerialNo, uttms as Type, utinmm as Month, utindd as Day, utinyy as Year, utmrmk as Remarks, utregs as registers, utmmke as Make, utmszc as Size, utstyl as Style
from htedta.ut550ap,
Where htedta.ut550ap.utlcid = htedta.lmabrep.abaucd

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2031 Posts

Posted - 01/31/2013 :  13:41:36  Show Profile  Visit jackv's Homepage  Reply with Quote
what happens if you run the first step on its own

select abaucd as LocID, abbdnb, abbenb from htedta.lmabrep


Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3585 Posts

Posted - 01/31/2013 :  13:57:21  Show Profile  Reply with Quote
As for the second query, I don't know the AS 400 syntax, but I think you need to list the second table as well.
select utmtr as SerialNo, uttms as Type, utinmm as Month, utindd as Day, utinyy as Year, 
	utmrmk as Remarks, utregs as registers, utmmke as Make, utmszc as Size, utstyl as Style
from htedta.ut550ap, htedta.lmabrep
Where htedta.ut550ap.utlcid = htedta.lmabrep.abaucd
Go to Top of Page

Tomsriv
Starting Member

USA
5 Posts

Posted - 01/31/2013 :  14:15:50  Show Profile  Reply with Quote
I tried both ways and it tells me "Keyword Select Not Expected"
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3585 Posts

Posted - 01/31/2013 :  14:20:09  Show Profile  Reply with Quote
What environment are you running this query in?
Go to Top of Page

Tomsriv
Starting Member

USA
5 Posts

Posted - 01/31/2013 :  14:39:59  Show Profile  Reply with Quote
The environment is called Looking Glass Geomanager. I'll see if I can do a similar query in ArcGIS ArcCatalog.
Go to Top of Page

Tomsriv
Starting Member

USA
5 Posts

Posted - 01/31/2013 :  14:46:21  Show Profile  Reply with Quote
No luck in ArcCatalog either. Each of these programs seem to need unique syntax.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3585 Posts

Posted - 01/31/2013 :  14:48:20  Show Profile  Reply with Quote
Most of the expertise on this forum is in Microsoft SQL Server. So if you are writing queries in those platforms, you would get better, faster, and more accurate answers on forums or other venues that have expertise in those platforms.
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 01/31/2013 :  15:50:26  Show Profile  Visit russell's Homepage  Reply with Quote
Looks like you're trying to do a join

select	abaucd as LocID, abbdnb, abbenb,
	tmtr as SerialNo, uttms as Type, utinmm as Month,
	utindd as Day, utinyy as Year, utmrmk as Remarks,
	utregs as registers, utmmke as Make, utmszc as Size,
	utstyl as Style
from	htedta.lmabrep
INNER JOIN
	htedta.ut550ap
ON	htedta.ut550ap.utlcid = htedta.lmabrep.abaucd;
Go to Top of Page

Tomsriv
Starting Member

USA
5 Posts

Posted - 01/31/2013 :  15:59:26  Show Profile  Reply with Quote
You may be right James. I should ask in the SQL 2000 forum because I bet that is the language this program needs.

Russel,
Thank you for making a very well organized example. I'll see if I can make it work in another program.
Go to Top of Page

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2031 Posts

Posted - 02/01/2013 :  12:56:42  Show Profile  Visit jackv's Homepage  Reply with Quote
Tomsrive - have you attempted to run this code on a different client such as iSeries navigator ?

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000