If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > SQL statement works only every other time

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-30-10, 01:33
tosa tosa is offline
Registered User
 
Join Date: Feb 2010
Posts: 35
SQL statement works only every other time

Hi!

I'm using a Progress database and an ASP.NET page that returns an error exactly every other time it is requested.

SQL statement:
SELECT SlsLine.LineNum, CASE WHEN SlsLine.AllDelivered = 1 THEN 'X' ELSE '0' END AS 'AllDelivered', Item.ItemName, Item.TechName, SlsLine.IntDlvDate, SlsLine.OrderNum, SlsLine.ItemCode, SlsLine.Version, CEILING(SlsLine.Qty) AS 'Qty', Item.QtyUnit, ROUND((SlsLine.Price*SlsLine.Qty),2) AS 'rowSum', ROUND(SlsLine.Price,2) AS 'Hinta', IFNULL(SysText.InfoText, '-') AS 'InfoText' FROM PUB.SlsLine INNER JOIN PUB.Item ON (SlsLine.ItemCode=Item.ItemCode) LEFT OUTER JOIN PUB.SysText ON (SlsLine.SlsLineKey=SysText.SysTextKey) AND SysText.NoteType = 'OrdConfRowE' AND SysText.ConsTxt = '' WHERE (SlsLine.OrderNum = '" & o & "') ORDER BY SlsLine.LineNum

The error returned with .NET page:
ERROR [23000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Integrity constraint violation:uniqueness constraint violation (7518)

I tried the SQL in ODBCTest and it returned this error (and eventually crashed):
[DataDirect][ODBC Progress OpenEdge Wire Protocol driver]Associated statement is not prepared. I once got it to return the rows.

What could be wrong with my SQL? And how can it work half the time?

I've tried removing bits of the SQL for testing, like the CASE function and some JOINs but to no avail.

Thanks for any help!
Reply With Quote
  #2 (permalink)  
Old 07-30-10, 03:20
tosa tosa is offline
Registered User
 
Join Date: Feb 2010
Posts: 35
Cause

Ok, so I've isolated the problem to the right tables and columns. This SQL behaves in the same way:

SELECT SlsLine.OrderNum, SysText.InfoText FROM PUB.SlsLine LEFT JOIN PUB.SysText ON SlsLine.SlsLineKey=SysText.SysTextKey AND SysText.NoteType = 'OrdConfRowE' AND SysText.ConsTxt= ' ' WHERE SlsLine.SlsLineKey = '1623405'

But I still don't get it...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On