Solved

Microsoft, SQL, 2005, Update Script help

Posted on 2008-10-17
4
477 Views
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'
0
Comment
Question by:Jeff S
4 Comments
 
LVL 22

Accepted Solution

by:
dportas earned 200 total points
ID: 22743808
UPDATE PatientVisitFiling
SET TypeOfBill = '731'
WHERE EXISTS
(SELECT 1
 FROM PatientVisit pv
 WHERE pv.PatientVisitId = PatientVisitFiling.PatientVisitId
  AND pv.VisitOwnerMId = '6');
0
 
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'
0
 
LVL 9

Assisted Solution

by:vavjeeva
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'
0
 
LVL 7

Author Closing Comment

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

919 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now