conditional split statement
hi i have following data Case 2 sortid code 1 0 2 null 3 null 4 null 5 null Case 2 sortid code 1 1 2 null 3 null 4 null 5 null what conditional statement should i used so that only all rows from case1 or all rows from case 2 goes to database
May 14th, 2012 5:21am

I'm afraid I don't understand the issue here. Please could you rephrase, explaining in more detail exactly what it is that you want to do. By "conditional statement" do you mean a case definition inside the Conditional Split component? Where do case1 & case 2 reside? Help us to help you.ObjectStorageHelper<T> A WinRT utility for Windows 8 | http://sqlblog.com/blogs/jamie_thomson/ | @jamiet | About me
Free Windows Admin Tool Kit Click here and download it now
May 14th, 2012 6:29am

It seems like case1 and case2 are two different downstream data flows. Is it so? What should be the deciding factor here?Please vote as helpful or mark as answer, if it helps Cheers, Raunak | t: @raunakjhawar | My Blog
May 14th, 2012 6:46am

yes i want expression inside conditional split componant, case 1 and case 2 is just to indicate to different set of data or simple i want if code==0 then all 4 rows from case 1 goes to table and if code==1 then all 4 rows from case 2 goes to table
Free Windows Admin Tool Kit Click here and download it now
May 14th, 2012 6:47am

insert into tbl select * from ( select * from case1 union all select * from case2 ) as der Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
May 14th, 2012 6:47am

yes i want expression inside conditional split componant, case 1 and case 2 is just to indicate to different set of data OK, so try the following as your case definition: [code] == 0 || [code] == 1 ObjectStorageHelper<T> A WinRT utility for Windows 8 | http://sqlblog.com/blogs/jamie_thomson/ | @jamiet | About me
Free Windows Admin Tool Kit Click here and download it now
May 14th, 2012 6:49am

hi, what about null values
May 14th, 2012 7:00am

I assume that your 2 datasets are coming from 2 different source and they are not easy to do in one sql statement. then based on your question, I will add 1 derived column transformation under each of the data source: for example: Case_Identifier and assign the first dataset as value 1 and the second as the value 2. I union all these 2 datasets together with 3 columns sortid, code, and Case_Identifier. I create a user variable as intCaseToInsert as int32. under Union All transformation I add a conditional split, I set Case_Identifier == @[user::intCaseToInsert] now you can control which dataset to insert to your database.
Free Windows Admin Tool Kit Click here and download it now
May 14th, 2012 7:02am

hi, what about null values What about them? With respect, I understand that there may be a language barrier but you really have to make more effort to explain what it is that you require. We can't help if you don't take the time to explain what it is that you need.ObjectStorageHelper<T> A WinRT utility for Windows 8 | http://sqlblog.com/blogs/jamie_thomson/ | @jamiet | About me
May 14th, 2012 7:03am

hi, dataset 1 sortid code name 1 0 x 2 null y 3 null z 4 null w 5 null q dataset sortid code name 1 1 a 2 null b 3 null c 4 null d 5 null e these are two dataset i want conditional statement so if code ==0 then all the 5 rows from dataset 1 goes to table and if code ==1 then all the rows of dataset 2 goes to table
Free Windows Admin Tool Kit Click here and download it now
May 14th, 2012 7:52am

hi, dataset 1 sortid code name 1 0 x 2 null y 3 null z 4 null w 5 null q dataset sortid code name 1 1 a 2 null b 3 null c 4 null d 5 null e these are two dataset i want conditional statement so if code ==0 then all the 5 rows from dataset 1 goes to table and if code ==1 then all the rows of dataset 2 goes to table OK, thanks for the explanation, now we're getting somewhere. So let me clarify, if [code] column of the first row in the dataset equals 0 OR 1 then that row and the four subsequent rows all need to be sent to some destination table. Correct? Assuming that what I just said is correct (which you need to confirm)...this can't be achieved using the Conditional Split alone because that works on a row at a time, you can't base your condition on a previous row. ObjectStorageHelper<T> A WinRT utility for Windows 8 | http://sqlblog.com/blogs/jamie_thomson/ | @jamiet | About me
May 14th, 2012 8:03am

For a faster response, you need to give a detailed view or perhaps the package design. Please vote as helpful or mark as answer, if it helps Cheers, Raunak | t: @raunakjhawar | My Blog
Free Windows Admin Tool Kit Click here and download it now
May 14th, 2012 8:07am

yes , i have tried (sortid==1 && code==0) || (sortid>1 && ISNULL(code)) (sortid==1 && code==1) || (sortid>1 && ISNULL(code)) this works fine when code==0 but not for code==1
May 14th, 2012 8:11am

Hi baba k, I agreed with Jamie said that this can't be achieved using the Conditional Split alone, and I suggest you can use Steven Wang's suggestion that add one derived column transformation under each of the data source. Thanks, Eileen
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 4:14am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics