Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, November 25, 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: SQL Update Statement Help
Bailey1
Posts: 57
 
SQL Update Statement HelpYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Feb 08 7:37 AM
I am trying to update all contacts which are the ONLY contact for an account to make them the primary contact. I tried executing the following SQL statement in the SLX Administrator, but I get errors: Failed to parse SQL
update contact
set isprimary = 'T'
from contact c1
INNER JOIN (
select accountid
from contact
group by accountid
HAVING COUNT(*) = 1 ) c2
ON c1.accountiD = c2.accountid
where (isprimary is null or isprimary = 'F')

I then tried using a temp table to hold the account ids to be updated instead of the subquery, but that didn't work either. It doesn't seem to be able to create tables using a script. Both queries work fine in SQL Server Query Analyzer, but I need the changes to be synched down to the remote databases, so I need to run them in the SLX Admin. I am on SLX ver 6.1.3 Any suggestions?
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: SQL Update Statement HelpYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Feb 08 4:41 PM
The SLX OLEDB provider does not support UPDATE ... FROM ... queries, so forget that.

If you can recast your query to use a subquery instead, it has a far greater chance of running.

UPDATE CONTACT
SET IsPrimary = 'T'
Where Contact.ContactID IN (Select c2.ContactID from Contact C2 ......)

6.1.3 ... that was a long time ago - good luck.

Phil
[Reply][Quote]
Bailey1
Posts: 57
 
Re: SQL Update Statement HelpYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Feb 08 7:11 AM
Thanks - that worked!
[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): 11/25/2024 2:54:25 PM