Try wrapping the SELECT with parentheses.

Elvis

Celebrating 10-Years of SQL Performance Excellence


-----Original Message-----
Subject: RE: Simple(?) SQL question


I may be doing something wrong, or MS-SQL is just a tad different from 
System i.

On our test system, I entered this:

update pre_case as a
    set (a.patient_name) =
        select coalesce(b.patient_name,a.patient_name)
             from demographic as b
            where a.medical_record_no = b.medical_record_no
                   and a.medical_record_no = '990030133'

Here is the error I received:

Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'as'.


For testing, I just wanted to modify records associated with a single
medical record.  Likely, that will have to be what will be done on the live 
database. Too much unusual data to do a global change.

So, anybody either see something wrong with what I entered, or perhaps the
statement only works on System i, as written?

It is Friday.  This mess will still be here next week.

John McKee

Quoting Alan Shore <AlanShore@xxxxxxxx>:




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.