6/20/2025 10:35:46 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Failed to parse SQL - Complex SQL statements
Posted: 31 Aug 07 11:14 AM
|
Is there a way to get a complex SQL statement to run in v7 ? They used to run no problem in 5.2 and prior, and when I moved to 6.2 I got them to work using DAO and ODBC as a workaround, but in version 7 I using SLX_DB recordsets get the same Failed to parse SQL error I got in 6.2. And when I attempt to use the 6.2 workaround using DAO in 7, I get a .dll error.
Here is a sample SQL statement which used to run in 5.2 but fails now...
strsql = "If (Select TYPE from CONTACT where CONTACTID = 'CK2VD0000813') = 'Test' Select LASTNAME as LNAME from CONTACT where CONTACTID = 'CK2VD0000813' Else Select '(unknown)' as LNAME"
This was my workaround code that works in 6.2 but not 7...
Const dbUseODBC = 1 Const dbDriverNoPrompt = 1 Const dbOpenDynaset = 2 Dim DBEngine As Object Dim wrk As Object Dim cnn As Object Dim rst As Object
Set DBEngine = CreateObject("DAO.DBEngine.36") Set wrk = DBEngine.CreateWorkspace("NewODBCDirect", "sa", "", dbUseODBC) 'Create the workspace Set cnn = wrk.OpenConnection("SLX", dbDriverNoPrompt, False, "ODBC;DSN=SalesLogix Production;UID=sysdba WD=masterkey;DATABASE=SalesLogix") ' Open connection. Set rst = cnn.OpenRecordset(strSQL, dbOpenDynaset) ' Open recordset on connection.
Any ideas on how to get this to run in 7?
Thank you. |
|
|
|
Re: Failed to parse SQL - Complex SQL statements
Posted: 31 Aug 07 11:58 AM
|
How about rewriting your SQL statement:
SELECT CASE WHEN TYPE = 'Test' THEN LASTNAME ELSE '(unknown)' END AS LNAME FROM CONTACT WHERE CONTACTID = 'CK2VD0000813'
Same result, simpler syntax and it will run in SLX |
|
|
| |
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|