ShadowMage Posted April 8, 2011 Share Posted April 8, 2011 I have an interesting situation. I had a query that was working, but I realized that I needed to add another field to the query. So I added the field to the previous query, and then the query failed.This is the query I'm trying to run (I just added the PartTran.SysTime field and added an ORDER BY for SysTime): SELECT Part.PartNum, PartTran.TranDate, PartTran.SysTime, PartTran.MtlUnitCost, Part.AvgMaterialCost FROM Part Part INNER JOIN PartTran PartTran ON (Part.Company = PartTran.Company AND Part.PartNum = PartTran.PartNum) WHERE ((Part.InActive = 0) AND (PartTran.TranDate >= '2010-10-08') AND (PartTran.TranType = 'PUR-STK')) ORDER BY Part.PartNum ASC, PartTran.TranDate DESC, PartTran.SysTime DESC That throws the following error:Warning: odbc_exec() [function.odbc-exec]: SQL error: [DataDirect-Technologies][ODBC PROGRESS driver][PROGRESS]Syntax error (7587), SQL state 37000 in SQLExecDirect in c:\Inetpub\phplib\ODBC.php on line 229I've had problems in the past with the ORDER BY clauses so I tried removing the ORDER BY clause for the PartTran.SysTime field but that still threw the error. On a whim, I tried changing SysTime to a different column name...which worked. This is the query I have now: SELECT Part.PartNum, PartTran.TranDate, PartTran.TranType, PartTran.MtlUnitCost, Part.AvgMaterialCost FROM Part Part INNER JOIN PartTran PartTran ON (Part.Company = PartTran.Company AND Part.PartNum = PartTran.PartNum) WHERE ((Part.InActive = 0) AND (PartTran.TranDate >= '2010-10-08') AND (PartTran.TranType = 'PUR-STK')) ORDER BY Part.PartNum ASC, PartTran.TranDate DESC So my question is:What might make one column throw an error while another one does not? Is it possible to specify column-specific permissions/accessibility?Any thoughts/advice would be much appreciated. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 8, 2011 Share Posted April 8, 2011 "systime" might be a reserved word. Is this MySQL? Link to comment Share on other sites More sharing options...
ShadowMage Posted April 8, 2011 Author Share Posted April 8, 2011 "systime" might be a reserved word. Is this MySQL?Ah, never thought about that.....is there any way to make sure it's looking for a column name instead of the reserved word?(No, it's not MySQL, it's Progress) Link to comment Share on other sites More sharing options...
justsomeguy Posted April 8, 2011 Share Posted April 8, 2011 If it uses the same syntax as MySQL, column names should go in backquotes. SQL Server uses square brackets. I can't find a lot of documentation for Progress. Also double-check to make sure the column exists in the table and is spelled correctly. Link to comment Share on other sites More sharing options...
ShadowMage Posted April 8, 2011 Author Share Posted April 8, 2011 If it uses the same syntax as MySQL, column names should go in backquotes. SQL Server uses square brackets. I can't find a lot of documentation for Progress. Also double-check to make sure the column exists in the table and is spelled correctly.Hmm...neither the backticks nor the square brackets worked.... :)I'll have to try to dig up some documentation on Progress, I guess. Thanks for the help, jsg. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.