[windows2000] MS SQL QUESTION: PLEASE HELP!

  • From: "Matthew Studer" <matthew_studer@xxxxxxxxxxx>
  • To: windows2000@xxxxxxxxxxxxx
  • Date: Fri, 22 Nov 2002 11:24:00 -0500

 I am trying to make these 2 statements (see below) into1 statement so it
will find AND delete duplicate entries.  I don't want to do each manually. 
It takes me too long to enter each value in that my select statement finds
before deleteing it.   But I can't just substitute DELETE for SELECT or it
says:   Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '*'.   Any ideas????
************************************* *************************************  
MS SQL SERVER VER 8.00   --UPS
-- Step 1;This script will detect if any duplicates are in the
NCT_UPS_Import_Data_Totals Table 
Select PackageReference2, count(PackageReference2)as 'TRANS'
into ##TEMP1
from NCT_UPS_Import_Data_Totals 
group by PackageReference2 
Select * from NCT_UPS_Import_Data_Totals A join ##TEMP1 B on
A.PackageReference2 = B.PackageReference2 where B.TRANS <>'1'     -- Step
2;Use this script to delete the desired duplicate by modifing the fields
PackageReference2 and CODFrt Delete from NCT_UPS_Import_Data_Totals where
PackageReference2 = 'MY INVOCE # GOES HERE' and CODFrt = 'MY NUMERIC VALUE
FOR MY COD CHARGES GOES HERE'


 

----------------------------------------------------------------------------
STOP MORE SPAM with the new MSN 8[1] and get 2 months FREE* 

--- Links ---
   1 http://g.msn.com/8HMDEN/2015

==================================
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: