|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-10-23 : 09:31:22
|
| Anita writes "Hello,I have the following code and the if statements do not seem to be working. I was wondering if someone can help me with this. I also would like to know if the code can be slimmed down a bit.Thank you,Anita Declare @count as numericif (select REQUEST from TEST_REPORT.dbo.TEAM3B_PULL_TOTAL_TST) != (select REQUEST from TEST_REPORT.dbo.REQUEST_BUS_REQ_TST) beginInsert into TEST_REPORT.dbo.REQUEST_BUS_REQ_TST (request,business_req_id,bus_test,test_case_id,test_case_source,test_case_descr)select distinct request,business_req_id,bus_test,test_case_id,test_case_source,test_case as test_case_description from TEST_REPORT.dbo.TEAM3B_PULL_TOTAL_TSTwhere request_close_date < (select getdate()) set @count = @count +1end Elseif (select REQUEST from TEST_REPORT.dbo.TEAM3B_PULL_TOTAL_TST) != (select REQUEST from TEST_REPORT.dbo.REQUEST_BUS_REQ_TST) beginInsert into TEST_REPORT.dbo.REQUEST_BUS_REQ_TST (request,business_req_id,bus_test,test_case_id,test_case_source,test_case_descr)select request,business_req_id,bus_test,test_case_id,test_case_source,test_case as test_case_descriptionfrom TEST_REPORT.dbo.TEAM3B_PULL_TOTAL_TSTOrder by REQUEST,BUSINESS_REQ_ID,TEST_CASE_ID endif (select REQUEST from TEST_REPORT.dbo.TEAM3B_PULL_TOTAL_TST) != (select REQUEST from TEST_REPORT.dbo.BUS_REQ_DESCRIPTION_TST) beginInsert into TEST_REPORT.dbo.BUS_REQ_DESCRIPTION_TST(request,business_req_id,source)select distinct request,business_req_id,test_case_source as source from TEST_REPORT.dbo.TEAM3B_PULL_TOTAL_TSTwhere request_close_date < (select getdate()) set @count = @count +1endElse begindelete TEST_REPORT.dbo.RDD_UPDATE_TSTInsert into TEST_REPORT.dbo.RDD_UPDATE_TST(request,business_req_id,test_case_id,test_case_descr)select distinct request,business_req_id,test_case_id,test_case_descr from TEST_REPORT.dbo.TEAM3B_PULL_TOTAL_TSTwhere request_close_date < (select getdate()) order by REQUEST,BUSINESS_REQ_ID,TEST_CASE_ID end" |
|