MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old June 8th, 2004, 02:51 PM
asmo asmo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 22 asmo User rank is Private First Class (20 - 50 Reputation Level)asmo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Operation must use an updateable query?

What does that error even mean? I've done some research, and the biggest problem was Permissions, but I've triple checked that, and permissions are NOT the problem. Anyone have any ideas?

I posted my code, just in case someone spotted an error

UPDATE
dbo_optionee AS opt,
TESTDTA_F060116 AS jde2,
TESTDTA_F0116 AS jde1,
QMaxDate
SET
opt.ADDRESS1 = UCASE(jde1.ALADD1),
opt.ADDRESS2 = UCASE(jde1.ALADD2),
opt.ADDRESS3 = UCASE(jde1.ALADD3),
opt.ADDRESS4 = UCASE(jde1.ALADD4),
opt.CITY = UCASE(jde1.ALCTY1),
opt.STATE = UCASE(jde1.ALADDS),
opt.ZIP = UCASE(jde1.ALADDZ)
WHERE
opt.SOC_SEC=jde2.YASSN And
jde2.YAAN8=jde1.ALAN8 And
jde1.ALAN8=QMaxDate.ALAN8 And
QMaxDate.MaxDate=ConvertJulian([jde1.ALEFTB]);

And here's the QMaxDate query (I guess the error is about this, but how?)

SELECT ALAN8, MAX(ConvertJulian([ALEFTB])) AS MaxDate
FROM TESTDTA_F0116
GROUP BY ALAN8;


Basically, the code is looking at a database, finding the most recent address for every person, and updating another database with that information.

Let me know if I can do anything to clarify my question... I really need help with this one

Thanks again guys,
Steve

Reply With Quote
  #2  
Old June 8th, 2004, 03:13 PM
teki associates teki associates is offline
Retired
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 252 teki associates User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 20 sec
Reputation Power: 4

Reply With Quote
  #3  
Old June 8th, 2004, 03:52 PM
asmo asmo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 22 asmo User rank is Private First Class (20 - 50 Reputation Level)asmo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I actually have- I made sure the first three aren't the case, so there's a problem with the 4th condition. But I'm not really sure how to fix it, I don't know what a crosstab is, SQL-pass through, etc. I am doing an Update, but I don't really know where to fix my problem. I saw a help document online that said to put the aggregate functions in the update statement itself, but doing so would have me but it in the WHERE part in this case. I don't know if there is a way to fix it...

Reply With Quote
  #4  
Old June 9th, 2004, 06:37 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 24th Plane (16500 - 16999 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 16,745 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 2 Days 21 h 39 m 51 sec
Reputation Power: 870
Code:
update dbo_optionee 
   set opt.ADDRESS1 = UCASE(jde1.ALADD1)
     , opt.ADDRESS2 = UCASE(jde1.ALADD2)
     , opt.ADDRESS3 = UCASE(jde1.ALADD3)
     , opt.ADDRESS4 = UCASE(jde1.ALADD4)
     , opt.CITY = UCASE(jde1.ALCTY1)
     , opt.STATE = UCASE(jde1.ALADDS)
     , opt.ZIP = UCASE(jde1.ALADDZ)
  from dbo_optionee AS opt
inner
  join TESTDTA_F060116 AS jde2
    on opt.SOC_SEC
     = jde2.YASSN
inner
  join TESTDTA_F0116 AS jde1
    on jde2.YAAN8
     = jde1.ALAN8
 where ConvertJulian([jde1.ALEFTB])
     = ( select max(ConvertJulian([ALEFTB]))
           from TESTDTA_F0116
          where ALAN8
              = jde1.ALAN8 )


sql server does not have stored queries like access does, in sql server you have to use a view for that

in this case a correlated subquery seems to be what you want
__________________
r937.com | rudy.ca

Reply With Quote
  #5  
Old June 9th, 2004, 07:40 AM
asmo asmo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 22 asmo User rank is Private First Class (20 - 50 Reputation Level)asmo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That actually looks like exactly what I want! But when I try to run it, it saying there is a syntax error (missing operator) at

UCASE(jde1.ALADDZ)
from dbo_optionee AS opt
inner
join TESTDTA_F060116 AS jde2
on opt.SOC_SEC...

The FROM statemtent is almost exactly what I was using when I was trying to get the right data, so I don't know what the problem is.

That's a great help though, I didn't know I could use FROM statements in UPDATE statements.

Anyway, if someone can help me fix this error, it would be HUGELY appreciated I'll be working on it too, so if I fix it, I shall let ya know.

Reply With Quote
  #6  
Old June 9th, 2004, 09:30 AM
asmo asmo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 22 asmo User rank is Private First Class (20 - 50 Reputation Level)asmo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Alright, got it working- I don't think Access lets me use FROM in the Update statement.

Here's what I ended up with

UPDATE
dbo_optionee AS opt,
TESTDTA_F060116 AS jde2,
TESTDTA_F0116 AS jde1
SET
opt.ADDRESS1 = UCASE(jde1.ALADD1),
opt.ADDRESS2 = UCASE(jde1.ALADD2),
opt.ADDRESS3 = UCASE(jde1.ALADD3),
opt.ADDRESS4 = UCASE(jde1.ALADD4),
opt.CITY = UCASE(jde1.ALCTY1),
opt.STATE = UCASE(jde1.ALADDS),
opt.ZIP = UCASE(jde1.ALADDZ)
WHERE
opt.SOC_SEC=jde2.YASSN And
jde2.YAAN8=jde1.ALAN8 And
(SELECT
MAX(ConvertJulian([ALEFTB]))
FROM TESTDTA_F0116
WHERE ALAN8 = jde1.ALAN8)
=ConvertJulian([jde1.ALEFTB]);


However, I still need some help, but it's a much different question. I'll post it in the Database development forum, titled 'Optimization'

Reply With Quote
  #7  
Old June 9th, 2004, 11:11 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 24th Plane (16500 - 16999 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 16,745 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 2 Days 21 h 39 m 51 sec
Reputation Power: 870
tip: if you are really running access, and not sql server, don't post in the sql server forum

Reply With Quote
  #8  
Old June 9th, 2004, 11:32 AM
asmo asmo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 22 asmo User rank is Private First Class (20 - 50 Reputation Level)asmo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ah, it said MS SQL, I thought that was just MicroSoft SQL implementations in general, not SQL Server specifically (which I would asssume would be a different abbreviation...)

Sorry about that...

Reply With Quote
  #9  
Old June 9th, 2004, 11:35 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 24th Plane (16500 - 16999 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 16,745 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 2 Days 21 h 39 m 51 sec
Reputation Power: 870
no prob

you are not the first to do it, and i'm sure you won't be the last

perhaps the MS SQL forum should be renamed, but i doubt it will be, since the name was carefully chosen so that it turns up in search engines in response to certain targetted keywords

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Operation must use an updateable query?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway