Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, May 17, 2024 
 
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!
 Administration Forums - Database Administration
Forum to discuss SQL Server or Oracle database administration related to SalesLogix databases. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Database Administration | New ThreadView:  Search:  
 Author  Thread: More SQL Update Help
Bailey1
Posts: 57
 
More SQL Update Help Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Feb 08 7:22 AM
I have another update query that I am trying to run thru SLX Admin, and I'm getting a Fail to Parse error. Here is the code:
UPDATE SYSDBA.U_ACCOUNT
SET ESTCLOSEVAL =
CASE
WHEN (UA.NUM_WEARER > 100)
and (UA.PROGRAM_TYPE in ('No Programmer', 'Direct Sale'))
THEN 300
WHEN (UA.NUM_WEARER > 50 AND UA.NUM_WEARER <= 100)
and (UA.PROGRAM_TYPE in ('No Programmer', 'Direct Sale'))
THEN 250
WHEN (UA.NUM_WEARER >= 30 AND UA.NUM_WEARER <= 50)
and (UA.PROGRAM_TYPE in ('No Programmer', 'Direct Sale'))
THEN 200
WHEN (UA.NUM_WEARER > 500)
and (UA.PROGRAM_TYPE in ('Rental'))
THEN 2000
WHEN (UA.NUM_WEARER >= 300 AND UA.NUM_WEARER <= 500)
and (UA.PROGRAM_TYPE in ('Rental'))
THEN 1000
WHEN (UA.NUM_WEARER > 100 AND UA.NUM_WEARER <= 299)
and (UA.PROGRAM_TYPE in ('Rental'))
THEN 500
WHEN (UA.NUM_WEARER > 50 AND UA.NUM_WEARER <= 100)
and (UA.PROGRAM_TYPE in ('Rental'))
THEN 350
WHEN (UA.NUM_WEARER >= 30 AND UA.NUM_WEARER <= 50)
and (UA.PROGRAM_TYPE in ('Rental'))
THEN 250
ELSE UA.ESTCLOSEVAL
END
from SYSDBA.U_ACCOUNT UA

Does the SLX Admin handle CASE statements? If not, is there another way to write this without breaking it up into several update statements ? We're on SLX 6.1.3.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: More SQL Update Help Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Feb 08 7:24 AM
Your problem is:
".. UPDATE... Set ... FROM.."
This syntax will not work with the Provider.

You need to take a sub-select approach:
Update.. Set .. Wehere ... In/= (Select From... where..)

--
RJLedger - rjlSystems
[Reply][Quote]
Bailey1
Posts: 57
 
Re: More SQL Update Help Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Feb 08 8:59 AM
Actually, the Update..Set..From does not appear to be the problem. When I removed the CASE statement and added where clauses instead, it worked fine. The code below executed fine in SLX Admin:
UPDATE SYSDBA.U_ACCOUNT
SET MODIFYDATE=GETDATE(),
ESTCLOSEVAL = 1000
FROM SYSDBA.U_ACCOUNT UA
INNER JOIN sysdba.ACCOUNT A ON A.ACCOUNTID = UA.ACCOUNTID
INNER JOIN sysdba.USERINFO UI ON UI.USERID = A.ACCOUNTMANAGERID
WHERE (ESTCLOSEVAL IS NULL OR ESTCLOSEVAL = 0)
AND UI.DIVISION in ('080', '081', '082', '083','086', '087', '090', '095', '096', '097', '098', '217', '218')
AND UA.NUM_WEARER_RANGE = 'A'
AND (UA.NUM_WEARER >= 300 AND UA.NUM_WEARER <= 500)
AND UA.PROGRAM_TYPE in ('Rental')
AND UI.DEPARTMENT = 'SALES'
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: More SQL Update Help Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Feb 08 5:08 PM
Are you sure that this works? You added it as a query in Tools / Execute SQL and ran it?

I've tried this on a 7.2.1 instance and it does not come close to running - parse error.

UPDATE..FROM is definitely a problem in all of the testing I have done, as is using the sysdba prefix (you are already logged in as sysdba, you should not include the prefix).

Phil
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: More SQL Update Help Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Feb 08 2:16 AM
Yes, this is 6.1 and didn't have the update../from issue - only vsn 6.2 on have that.
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: More SQL Update Help Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Feb 08 3:28 AM
Thanks Mike.
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 5/17/2024 8:57:18 PM