Error changed a bit.  Here is statement:

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

and here is error:

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'a'.

I am only guessing here, but is a word missing?

John McKee

Quoting Alan Shore <AlanShore@xxxxxxxx>:

Try the statement by removing the 3 " as "
For example
update pre_case a
   set (a.patient_name) =
       select coalesce(b.patient_name,a.patient_name)
            from demographic b
           where a.medical_record_no = b.medical_record_no
                  and a.medical_record_no = '990030133'



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx

midrange-l-bounces@xxxxxxxxxxxx wrote on 03/09/2007 03:54:48 PM:

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>:

> True - if there are millions of records to be processed this could be a
> major factor where processing time is concerned
>
>
>
> Alan Shore
>
> NBTY, Inc
> (631) 244-2000 ext. 5019
> AShore@xxxxxxxx
>
> midrange-l-bounces@xxxxxxxxxxxx wrote on 03/08/2007 04:43:35 PM:
>
>> I'd add:
>>
>> AND A.PATIENT_NAME <> B.PATIENT_NAME
>>
>> To the where clause. Why bother updating a row where no update is
>> needed.
>>
>> -Walden
>>
>> --
>> Walden H Leverich III
>> Tech Software
>> (516) 627-3800 x3051
>> WaldenL@xxxxxxxxxxxxxxx
>> http://www.TechSoftInc.com
>>
>> Quiquid latine dictum sit altum viditur.
>> (Whatever is said in Latin seems profound.)
>>
>>
>> --
>> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
> list
>> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
>> To subscribe, unsubscribe, or change list options,
>> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
>> or email: MIDRANGE-L-request@xxxxxxxxxxxx
>> Before posting, please take a moment to review the archives
>> at http://archive.midrange.com/midrange-l.
>>
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>
>



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.






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.