SELECT CASE statement works on one database and not the other
SELECT CASE statement works on one database and not the other
(OP)
All,
I have two connection strings for two different customer Pervasive DBs. The query containing the CASE statement below works on the first DB and fails on the second DB, working on it only if I remove the statement. My version of Pervasive is 8. At this time I suspect the latter DB may be in a version that did not support the CASE statement? What PSQL statement returns the database version like SQL Server's SELECT @@VERSION?
I have two connection strings for two different customer Pervasive DBs. The query containing the CASE statement below works on the first DB and fails on the second DB, working on it only if I remove the statement. My version of Pervasive is 8. At this time I suspect the latter DB may be in a version that did not support the CASE statement? What PSQL statement returns the database version like SQL Server's SELECT @@VERSION?
CODE --> P-SQL
SELECT CASE DeptCode WHEN 'A' THEN '*' WHEN 'AB' THEN '*' WHEN 'AS' THEN '*' WHEN 'BS' THEN '*' WHEN 'C' THEN '*' WHEN 'D' THEN '*' WHEN 'E' THEN '*' WHEN 'F' THEN '*' WHEN 'FD' THEN '*' WHEN 'G' THEN '*' WHEN 'GM' THEN '*' WHEN 'I' THEN '*' WHEN 'JS' THEN '*' WHEN 'K' THEN '*' WHEN 'L' THEN '*' WHEN 'M' THEN '*' WHEN 'MK' THEN '*' WHEN 'N' THEN '*' WHEN 'P' THEN '*' WHEN 'PS' THEN '*' WHEN 'R' THEN '*' WHEN 'RK' THEN '*' WHEN 'S' THEN '*' WHEN 'SD' THEN '*' WHEN 'SL' THEN '*' WHEN 'T' THEN '*' WHEN 'V' THEN '*' WHEN 'W' THEN '*' WHEN 'Z' THEN '*' ELSE DeptCode END AS Code...
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
RE: SELECT CASE statement works on one database and not the other
Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com
RE: SELECT CASE statement works on one database and not the other
Thank you.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
RE: SELECT CASE statement works on one database and not the other
This does not work here, it does on the P V8:
CODE --> P-SQL
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
RE: SELECT CASE statement works on one database and not the other
As far as Subqueries, I thing they are only supported in the WHERE clause with V8.
If this is going to be an ongoing project, I would really suggest upgrading to PSQL v11. It does support the CASE statement and the table subquery. At the least, I would suggest downloading the PSQL v11 workgroup engine, installing it on a test machine, and trying it with your data / queries / application.
Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com