Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"SELECT TOP nn" in DTS

Status
Not open for further replies.

Jimmy211

Technical User
Aug 8, 2002
42
US
Hi,

I'm trying to use the "SELECT TOP nn" statement in a DTS transform data task and getting an error. The code I'm using is:

SELECT TOP 50 "TMS"."XACSTAT"."XACNUM"
FROM "TMS"."XACSTAT"

The error message I get is:

SQL0104N An unexpected token "50" was found following "SELECT TOP". Expected tokens may include: "<space>". SQLSTATE=42601

So is it not allowed to use the SELECT TOP statement in DTS? Or is there something different I should be doing?

Thanks,
Jimmy211
 
Try dropping the " as in ...

Code:
SELECT TOP 50 TMS.XACSTAT.XACNUM
FROM TMS.XACSTAT

Relay back the error if there is one.

Thanks

J. Kusch
 
Never mind, I figured it out. The reason the "TOP nn" switch doesn't work is because I'm trying to get the information from DB2, which doesn't support the "TOP nn" keyword. You have to use "FETCH FIRST nn ROWS ONLY" like this instead:

SELECT *
FROM "TMS"."XACSTAT"
ORDER BY XACNUM DESC
FETCH FIRST 10 ROWS ONLY

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top