.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Post New Web Links

Need help in splitting using Rowcount

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :Sql Server

Hi All,


I am somewhat new to SSIS, and working on a package which combines combines the data from 3 different sql queries using Union All, then checks the Row Count and decides whether to create the destination flat file or now.

My intention is to skip the creation of a blank file in case if no rows exist in the result set, and create it only if data rows are passed.

My current data flow sequence is as follows:

3* OLE Db source
Union All
Conditional Split

I am able to get the data past the RowCount component but unable to use conditional split transform to split the output based on Rowcount, since it does not let any data through based on the value of the Rowcount variable.

I have seen some scenarios that use Script component to get the split done, but not sure how to compare the variable value, and if any input columns need to be passed as inputs.

Can someone please point me on how to get this done?





View Complete Post

More Related Resource Links

Is it possible to prevent seeing results if rowcount is small?

Hi, we are about to start a new project. In the project we won't be owning the data to be analysed. The data provider is going to require some special rules for the usage of data. This is because the nature of data the - the data is going to be information sensitive. They are asking if we could implement a restriction which would prevent to see results rows if there is less than five result rows. I couldn't find any ideas how this could be done. Is it possible? How? We are running Sql Server 2008. Thank you in advance, Teemu Ajalin

Splitting a memo field into lines and adding a value at the start of each line

I have one memo field which has a bunch of text in it. I want to update another memo field from the first one but i want to divide it into lines of 50 characters and put a carriage return at the end of each line and a string value (Note:) at the beginning of each line But I am not sure how to go about it. The text in the first field may have line breaks and carriage returns or it may not. So is there a way i can strip out anything like that first See example below Memo Field1 The quick brown fox jumped over the lazy dog. And the Dish ran away with the spoon, the little dog laughed to see such fun and the Cow fell of the wall Memo Field2 Note: The quick brown fox jumped over the lazy dog. And Note: the Dish ran away with the spoon, the little dog l Note: aughed to see such fun and the Cow fell of the wal Note: l   ideally it wouldn't cut words in half but I think I may be asking too much.   Is this possible?

Splitting PDF

What will be the code to split a PDF file using iText and C#?Please give me the code.

How to find the rowcount of the dataset in a report


I have a report.

In one of the text field i have to show the rowcount of the dataset

How can i do that

Splitting up a database


Dear SQL Server experts,


Our client is hosting an application for many users, each user has its own database (stored at the server of our client). In this application there is an audit functionality integrated; all the changes that are done or logged in to two tables in the same (user)database. When there is a problem the client copies the production database to the acceptance server, where we can investigate. Because the databases are over 5GB, the transfer can take a bit of time. A huge part of the data is stored in the audit tables, so if we can split-up the audit this process could be a lot faster.

I’m trying to figure out the possible solutions, I already proposed to split the database into two different databases but the client wants to keep all the data in the same database.

Or there any other solutions (with minimal impact) that I should consider?


All databases or currently hosted on a sql 2000 server.


Thanks in advance,


Help in writing a funcion in Splitting Address field into City,state and zip in SQL


Hi All,

I have to split a column into  city/state/zip.
MACON GA 31220
ORLANDO, FL. 32817


city state zip

MACON GA 31220


I tried 2 cases:

declare @s varchar(100)
select @s = 'Los Angeles, CA 90022'
select charindex(',',@s)
CITY = substring(@s,0,charindex(',',@s))
,STATE = substring(@s,charindex(',',@s)+1,len(@s)- (charindex(',',@s)+1 + 5))
,"ZIP CODE " = RIGHT(@s,5)

declare @s varchar(100)
select @s = 'Los Angeles. CA 90022'
select charindex('.',@s)
CITY = substring(@s,0,charindex('.',@s))
,STATE = substring(@s,charindex('.',@s)+1,len(@s)- (charindex('.',@s)+1 + 5))
,"ZIP CODE " = RIGHT(@s,5)


Thanks ,


Group report splitting into multiple pages Need it in 1 page


1) Few of my group reports which have more than 500 rows are splitting into many pages without column header. (eg, page 1, page 2... etc.) I would like configure it to be in one page however large it may be.

2) I tried setting column header in group reports which are splitting into multiple pages but its not working.

Either I need achieve point 1 or point 2

Could you please help me how to achieve it?




Hi Experts,

How to execute below query, I'm getting error:-










Any Help?



splitting querystring and searching profile?



How would i go about searching for data in the profile system?

I am looking to make a page with a search bar - type in a name, and this goes to searchresults.aspx?id=what you just searched.

How then do I select the Profile.FirstName and Profile.LastName within the profiletable?

Because it is the auto generated profile system, these values are stored withing the Profile table but not as seperate columns..

Also, how do i split up the querystring into a first name and last name to match to the seperate profiles?


@@Rowcount returning incorrect value on second try


Hi all,

I have what I think is some rather strange behavior using @@Rowcount in SQL Server 2005.

Basically, in some T-SQL I'm coding I've been trying to use @@Rowcount after an INSERT to count how many rows were affected.  However, I've been finding that although the code works properly the first time I run it, on subsequent occasions it gives me a zero count for @@Rowcount.  I wrote some test code to see if this is a repeatable problem and it seems to be. 

Below is my test code.  Basically, it goes as follows:

  • Create a table containing some lines of fake data
  • Create a temp table to store the rowcount from a select statement
  • Select all the rows in the fake data table and update the temp table with the value of @@Rowcount
  • Show me the temp table result
  • Delete the temp tables i created

Now the first time I run this code in a query window, the @@Rowcount is stored in the temp table correctly (100 rows affected).  If I rerun it, the value stored is zero.  All subsequent times I run it, I always get zero.  If I add a blank line, or some comment, or otherwise modify the code, sometimes it will run correctly again, but the next time gives me zero.  It seems very odd.

Now I can get around it by storing @@rowcount in a variable instead of a table entr

set rowcount


 there is a stored procedure contrain set rowcount.

create proc a
set rowcount 2
select * from tableA
set rowcount 0

create proc b
set rowcount 10
select * from tableA
set rowcount 0

is there any problem when i use proc a and proc b in the same time

Splitting string using RegEx



I have following string

string str = '1,2,23;33;33,4;66;77"

i want to split it like




Means if ; is coming after comma then i dont want the spilt.

Split will occur only if , is followed by , otherwise if , is followed by ;is should not be split.

How to go about it?


PL suggest.




chandan mahajan

Splitting functionality into dlls/separate code files


I'm trying to get a simple website up and running, and I'm new to asp.net.  I have:


  • default.aspx
  • default.aspx.cs
  • app_code
  • utils.cs
I'm trying to get code referenced in my utils file into the default code file.  When i "run" the webpage from within VS2008, everything works as i would expect, but trying to navigate directly to the http://localhost/test/default.aspx page, (using IIS, instead of whatever VS uses), it fails, saying that it didn't understand any references to the utils.cs
I've also tried rearranging the project so that utils.cs compiles into a dll, but this didn't work either - I could see the dll in my bin directory, but it wasn't linked in automatically (looking at the error, it was obvious that the dll wasn't included in the compiling of the aspx page)

Regular expression for splitting string



i have a string like this 


i want to split like this





pls help me 

thanks in advance

Regards, Anoop

Splitting strings and decimals in a text file

<textarea style="width: 100%; height: 100%; position: absolute; top: 0; left: 0; right: 0; bottom: 0;"></textarea><textarea style="width: 100%; height: 100%; position: absolute; top: 0; left: 0; right: 0; bottom: 0;"></textarea>
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend