Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi,I have following query. I want to insert the value MBR_COV_EFF_DATE to table fixed_MM if the function dbo.CheckTheDate2 returns correct date and if it returns NULL I want to insert it on error_MM table.How can I do this? select dbo.CheckTheDate2(MBR_COV_EFF_DATE,'MBR_COV_EFF_DATE') AS MBR_COV_EFF_DATE from [unfixed_MM]ThanksSanjeev
Kristen
Test
22859 Posts
Posted - 2007-09-24 : 11:08:36
I would do:
select dbo.CheckTheDate2(MBR_COV_EFF_DATE,'MBR_COV_EFF_DATE') AS MBR_COV_EFF_DATE, *INTO #TEMPFROM from [unfixed_MM]INSERT INTO fixed_MMSELECT *FROM #TEMPWHERE MBR_COV_EFF_DATE IS NOT NULLINSERT INTO error_MMSELECT *FROM #TEMPWHERE MBR_COV_EFF_DATE IS NULLDROP TABLE #TEMP
Kristen
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2007-09-25 : 03:54:49
What do you mean by correct date?MadhivananFailing to plan is Planning to fail