January 12, 2010 at 8:35 am
I am trying to insert 4 rows from #Dev to #QA, out of which 2 rows will fail converting
from varchar to datetime.
What i am trying to acheive is, the rows that will be converted to datetime should be inserted to #QA and the other error rows should be logged to #catch table.
This has to be done using T-SQL (not SSIS).
The below code is not working obviously. Any ideas please.
Thanks in advance.
create table #Dev (PName varchar(10), Rec_Dt varchar(8))
insert into #Dev values ('Absfsg','20090101')
insert into #Dev values ('Axdfere','20090102')
insert into #Dev values ('Error1','2009 010')
insert into #Dev values ('Error','axxcfffs')
--select * from #Table
create table #QA(PName varchar(10), Rec_Dt datetime)
begin try
insert into #QA
select * from #Dev
end try
begin catch
select * into #Catch
from #Dev
end catch
January 12, 2010 at 8:45 am
May be i posted in the wrong forum,
I posted this again at http://www.sqlservercentral.com/Forums/Topic846233-338-1.aspx
Please direct your response .
Sorry for the duplication.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply