Microsoft
Software
Hardware
Network
Question : SQL UPDATE Script Help needed.
I have a two part question ....
First thing is I need to Identify the procedures where dbo.ProceduresFeeSchedule.
ContractTy
peCodeMId IS NOT NULL.
from
SELECT
dbo.ProceduresFeeSchedule.
FeeSchedul
eId,
dbo.ProceduresFeeSchedule.
Fee,
dbo.ProceduresFeeSchedule.
ContractTy
peCodeMId,
dbo.Procedures.Code,
dbo.Procedures.CPTCode
FROM
dbo.ProceduresFeeSchedule
INNER JOIN dbo.Procedures ON dbo.ProceduresFeeSchedule.
Procedures
Id = dbo.Procedures.ProceduresI
d
WHERE
RIGHT(p.Code , 1) = 'T' AND
( dbo.ProceduresFeeSchedule.
FeeSchedul
eId = 35 ) OR
( dbo.ProceduresFeeSchedule.
FeeSchedul
eId = 36 )
I thought I could add in like this, but it returned values in my Code field that did not have a 'T'.
SELECT
dbo.ProceduresFeeSchedule.
FeeSchedul
eId,
dbo.ProceduresFeeSchedule.
Fee,
dbo.ProceduresFeeSchedule.
ContractTy
peCodeMId,
dbo.Procedures.Code,
dbo.Procedures.CPTCode
FROM
dbo.ProceduresFeeSchedule
INNER JOIN dbo.Procedures ON dbo.ProceduresFeeSchedule.
Procedures
Id = dbo.Procedures.ProceduresI
d
WHERE
dbo.ProceduresFeeSchedule.
ContractTy
peCodeMId IS NOT NULL AND
RIGHT(p.Code , 1) = 'T' AND
( dbo.ProceduresFeeSchedule.
FeeSchedul
eId = 35 ) OR
( dbo.ProceduresFeeSchedule.
FeeSchedul
eId = 36 )
After I fix this part, I need to do an update script based off this ....
UPDATE
ProceduresFeeSchedule
SET
dbo.ProceduresFeeSchedule.
ContractTy
peCodeMId = NULL
WHERE
..... my rows where dbo.ProceduresFeeSchedule.
ContractTy
peCodeMId was not null
Answer : SQL UPDATE Script Help needed.
you were missing logically grouping your OR statement together...which explains why you were getting results you weren't expecting.
Random Solutions
Cisco router allow remote remote management
Setting up Linux and Squid
Image uploader - drupal
LOGOUT from web authentication (htaccess/apache)
Symantec Protection Suite SBE 3.0 vs Symantec Endpoint Protection Suite SBE 12.0.1
Need to reduce a whole folder's pictures
WYSIWYG web builder
Slash between values question
Exchange 2007, out of office assistant not sending emails for older users
Looping through rows of controls