Microsoft, SQL, 2005, Update Script help

Posted on 2008-10-17
Last Modified: 2010-04-21
I want to update type of bill from 738 to 731 where the visit owner equals 6

Started it but its not going well ... any help is appreciated.

UPDATE PatientVisitFiling pvf FROM
INNER JOIN PatientVisit pv ON pvf.PatientVisitId = pv.PatientVisitId
SET pvf.TypeOfBill = '731' WHERE pv.VisitOwnerMId = '6'
Question by:Jeff S
LVL 22

Accepted Solution

dportas earned 200 total points
ID: 22743808
UPDATE PatientVisitFiling
SET TypeOfBill = '731'
 FROM PatientVisit pv
 WHERE pv.PatientVisitId = PatientVisitFiling.PatientVisitId
  AND pv.VisitOwnerMId = '6');
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 200 total points
ID: 22743828
UPDATE PatientVisitFiling
SET TypeOfBill = '731'
FROM PatientVisitFiling pvf INNER JOIN
      PatientVisit pv ON pvf.PatientVisitId = pv.PatientVisitId
WHERE pv.VisitOwnerMId = '6'

Assisted Solution

vavjeeva earned 100 total points
ID: 22743851
try this .. it should work

UPDATE PatientVisitFiling SET TypeOfBill = '731'  FROM PatientVisitFiling pvf
INNER JOIN PatientVisit pv ON pvf.PatientVisitId = pv.PatientVisitId
WHERE pv.VisitOwnerMId = '6'

Author Closing Comment

by:Jeff S
ID: 31507236
Split points to be fair ....  wish i could give all full credit

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question