| Author |
Topic  |
|
|
yaditzal
Starting Member
22 Posts |
Posted - 04/19/2010 : 12:35:07
|
I need to convert this select in a delete.
SELECT FROM [HEDIS_DATA].[dbo].[VISIT_IN] P1
INNER JOIN (SELECT * FROM [HEDIS_DATA].[dbo].[VISIT_IN] ) Pl1 ON Pl1.[CLAIM_ID]= SUBSTRING(P1.CLAIM_ID,CHARINDEX('R',P1.CLAIM_ID)+1,LEN(P1.CLAIM_ID))
WHERE LEFT(P1.[CLAIM_ID],1)='R'
please any help |
|
|
webfred
Flowing Fount of Yak Knowledge
Germany
8513 Posts |
Posted - 04/19/2010 : 12:38:15
|
Be sure to have a backup and then try this:
DELETE P1 FROM [HEDIS_DATA].[dbo].[VISIT_IN] P1 INNER JOIN (SELECT * FROM [HEDIS_DATA].[dbo].[VISIT_IN] ) Pl1 ON Pl1.[CLAIM_ID]= SUBSTRING(P1.CLAIM_ID,CHARINDEX('R',P1.CLAIM_ID)+1,LEN(P1.CLAIM_ID)) WHERE LEFT(P1.[CLAIM_ID],1)='R'
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47069 Posts |
Posted - 04/20/2010 : 01:04:27
|
actually there's no need for derived table after inner join as you're anyways selecting all the columns from it
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
webfred
Flowing Fount of Yak Knowledge
Germany
8513 Posts |
Posted - 04/20/2010 : 15:24:53
|
Yes, you're right - eagleeye  DELETE P1 FROM [HEDIS_DATA].[dbo].[VISIT_IN] P1 INNER JOIN [HEDIS_DATA].[dbo].[VISIT_IN] Pl1 ON Pl1.[CLAIM_ID]= SUBSTRING(P1.CLAIM_ID,CHARINDEX('R',P1.CLAIM_ID)+1,LEN(P1.CLAIM_ID)) WHERE LEFT(P1.[CLAIM_ID],1)='R'
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47069 Posts |
Posted - 04/21/2010 : 01:43:34
|
cool
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
| |
Topic  |
|