See ISDATE in BOL.
P
-----Original Message-----
From: Ahbaid Gaffoor [mailto:[Email Address Removed] Thursday, March 25, 2004 5:28 PM
To: LazyDBA.com Discussion
Subject: SQL Server 2000 data validation question
I have a table TLOAD loaded with data in varchar columns
I then execute a procedure to map the data into a target table TTARGET
the problem is that some of the data is mapped into datetime fields and
fails if the text is invaild
I'd like a way to handle failed insert attempts and continue processing
the data in a cursor loop,
however on hitting the first error the loop terminates and does not
continue processing, the transaction is also rolled back.
Any suggestions?
Thanks
P.S. the code I have so far looks like:
declare cursor c1 local for select somedata from TLOAD
open c1
fetch next from c1 into somevar
while @@fetch_status = 0
begin
insert into TTARGET values (somedata)
if @@ERROR <> 0
-- do stuff
fetch next from c1 into somevar
end
deallocate c1
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page