April 8, 2002 at 2:56 pm
I have created a DTS package that uses a text file as a source and then imports into a table. The problem is that when I run the package every record has two null records proceeding. I have created a SQL task to run at the end of the import that looks like this. The question is: Is there a better way to write the SQL statement to delete NULL records. THERE IS NO PRIMARY KEY or at least one that can be used as one. All Im looking for is a better way to write this SQL statement if there is one:
DELETE FROM dbo.Amisys_MMembInfo
WHERE (MemMonth IS NULL) AND (MemYear IS NULL) AND (MemContract_ID IS NULL) AND (MemLName IS NULL) AND (MemFname IS NULL) AND
(Sex IS NULL) AND (DOB IS NULL) AND (MemPCP_CareID IS NULL) AND (MemPCP_SeqID IS NULL) AND (MemOBGYN_PCPID IS NULL) AND
(MemOBGYN_PCP_SeqID IS NULL) AND (MemContract_Suffix IS NULL)
April 8, 2002 at 3:49 pm
First, is there a reason why you could get the source to stop doing this. Second if any one of those fields must have data in it you could just look for NULL on that column or a smaller combination of columns that way the query doesn't have to check so many. Also in regards to any column that will not be null except for these bad records you could cheat a little by making those columns not null and setting up to ignore errors but if something else goes wrong it may make issues harder on you.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply