Showing posts with label rows. Show all posts
Showing posts with label rows. Show all posts

Friday, March 23, 2012

How many rows...?

I'm developing an app that will allow a user to track clicks and sales by date/time. However, I was wondering with the potential for a TON of clicks, is it feasable to track individual clicks in a SQL Server 2000 or 2005 database? I'm talking potentially 50,000 products receiving thousands of clicks per day, coud the db handle that kind of traffic? Or should I stick with a running total of clicks per product, and forget about the ability to see a breakdown of clicks per day, etc?That data is going to get out of control rather fast. However you can keep a running total by day.|||How many rows can a typical table handle? 1 million? 500 million? 1 billion? More? That will help me figure out if I can track clicks daily, or if I have to track weekly or monthly.|||The only limitation of rows per table in SQL is the storage available, see 'Maximum Capacity Specifications' topic in SQL Books Online

How many rows has been affected?

hi everyone,

I’d like to know how many rows has been affected for this query. But I don’t want to use aprevious Sql Task style “SELECT COUNT(*) REGISTROS FROM…”

Such a query like that:

INSERT INTO TABLEDEST

SELECT F1,F2,

FROM TABLESOURCE

WHERE <CONDITION>

I’d like to retrieve that value from a later Script Task

Thanks a lot for your help and thoughts,

Moved from SSIS to t-sql forum...|||I don't know about getting it from a later script task, but you could get it from the same script task pretty easily. You could add a SELECT @.@.ROWCOUNT after your insert statement and then catch the result in a variable.
|||I agree. Use @.@.rowcount to get the rows affected, but getting it into a SSIS variable (or something similar) is beyond this forum. If you need to know that we can bounce it back to the SSIS forum Smile|||Thanks for that JayH. It was very useful.

Wednesday, March 21, 2012

How many rows can a given processor handle

Hi all,
I know this is a very general question but if anyone can give me even a
ballpark figure that would be a big help.
I have a database that in a single table has between 75 million and 150
million. These are the absolute maximum values.
The datatypes are all very simple and there is about 8 columns. This table
links to various other tables through standard relationships.
There are 6 other table.
When a join occurs, it occurs between at most, 3 tables.
My question -: Can a dual Xeon 3.06 dedicated sql server with 3Gb ram and
SCSI disks handle this dealing with 100 users at a time?
If not, could anyone suggest a spec that could
Thanks for any advice you can share
SimonWell, it all depends on what kind of joins and what other operations
needed.
Here're some estimate, 8 columns, 2 bytes each, so total 16 bytes per
row. Say it has 150 millions rows, that's
150,000,000 * 16 = 2,400,000,000 byte = 2.3 GB
Assume on average each user retrieves 1.5 millions rows (that's still
alot), then you should have enough memory to handle 100 users. CPU won't
be a problem unless you do some complicated calculations. I am more
worry about the disk performance since unless you design index right,
there may be table scans, which will really hurt the performance.
Eric Li
SQL DBA
MCDBA
Simon Harvey wrote:

> Hi all,
> I know this is a very general question but if anyone can give me even a
> ballpark figure that would be a big help.
> I have a database that in a single table has between 75 million and 150
> million. These are the absolute maximum values.
> The datatypes are all very simple and there is about 8 columns. This table
> links to various other tables through standard relationships.
> There are 6 other table.
> When a join occurs, it occurs between at most, 3 tables.
> My question -: Can a dual Xeon 3.06 dedicated sql server with 3Gb ram and
> SCSI disks handle this dealing with 100 users at a time?
> If not, could anyone suggest a spec that could
> Thanks for any advice you can share
> Simon
>|||Thanks for the reply Eric,
If anyone happens to have experience of using very large databases I would
really appreciate any information on the sort of machines that are being
used to run them
Thanks all
Simon|||here
http://www.microsoft.com/sql/evalua...ies/default.asp
Bojidar Alexandrov|||and "the one"
[url]http://www.microsoft.com/resources/casestudies/CaseStudy.asp?CaseStudyID=11205[/ur
l]
Bojidar Alexandrov|||For a large DB, like > 100 GB DB, most of the time, disk/memory is more
a concern than CPU, unless there're alot of complicated floating point
calculations, like financial risk analysis/scientific modeling,
otherwise, a 4 CPU config. should be good enough.
Memory is cheap now, get as much as you can, I was working on a 600 GB
DB before, and it run happily on a 8 GB machine.
Get SAN if you have $$$, or RAID 10, or multiple SCSI disk controllers,
partition your DB into different file groups and put different group on
different disk, if possible. There are just too many different ways, all
depend on how big your budget is.
Or you can get multiple machines, partition your DB and chain those
machines together.
There's no one-size-fit-all solution, you need a seasoned DBA to look at
your requirement.
Eric Li
SQL DBA
MCDBA
Simon Harvey wrote:

> Thanks for the reply Eric,
> If anyone happens to have experience of using very large databases I would
> really appreciate any information on the sort of machines that are being
> used to run them
> Thanks all
> Simon
>|||Thanks all.
Thats all really helpful. Cheers
Simon

How many rows can a given processor handle

Hi all,
I know this is a very general question but if anyone can give me even a
ballpark figure that would be a big help.
I have a database that in a single table has between 75 million and 150
million. These are the absolute maximum values.
The datatypes are all very simple and there is about 8 columns. This table
links to various other tables through standard relationships.
There are 6 other table.
When a join occurs, it occurs between at most, 3 tables.
My question -: Can a dual Xeon 3.06 dedicated sql server with 3Gb ram and
SCSI disks handle this dealing with 100 users at a time?
If not, could anyone suggest a spec that could
Thanks for any advice you can share
Simon
Well, it all depends on what kind of joins and what other operations
needed.
Here're some estimate, 8 columns, 2 bytes each, so total 16 bytes per
row. Say it has 150 millions rows, that's
150,000,000 * 16 = 2,400,000,000 byte = 2.3 GB
Assume on average each user retrieves 1.5 millions rows (that's still
alot), then you should have enough memory to handle 100 users. CPU won't
be a problem unless you do some complicated calculations. I am more
worry about the disk performance since unless you design index right,
there may be table scans, which will really hurt the performance.
Eric Li
SQL DBA
MCDBA
Simon Harvey wrote:

> Hi all,
> I know this is a very general question but if anyone can give me even a
> ballpark figure that would be a big help.
> I have a database that in a single table has between 75 million and 150
> million. These are the absolute maximum values.
> The datatypes are all very simple and there is about 8 columns. This table
> links to various other tables through standard relationships.
> There are 6 other table.
> When a join occurs, it occurs between at most, 3 tables.
> My question -: Can a dual Xeon 3.06 dedicated sql server with 3Gb ram and
> SCSI disks handle this dealing with 100 users at a time?
> If not, could anyone suggest a spec that could
> Thanks for any advice you can share
> Simon
>
|||Thanks for the reply Eric,
If anyone happens to have experience of using very large databases I would
really appreciate any information on the sort of machines that are being
used to run them
Thanks all
Simon
|||here
http://www.microsoft.com/sql/evaluat...es/default.asp
Bojidar Alexandrov
|||and "the one"
http://www.microsoft.com/resources/c...eStudyID=11205
Bojidar Alexandrov
|||For a large DB, like > 100 GB DB, most of the time, disk/memory is more
a concern than CPU, unless there're alot of complicated floating point
calculations, like financial risk analysis/scientific modeling,
otherwise, a 4 CPU config. should be good enough.
Memory is cheap now, get as much as you can, I was working on a 600 GB
DB before, and it run happily on a 8 GB machine.
Get SAN if you have $$$, or RAID 10, or multiple SCSI disk controllers,
partition your DB into different file groups and put different group on
different disk, if possible. There are just too many different ways, all
depend on how big your budget is.
Or you can get multiple machines, partition your DB and chain those
machines together.
There's no one-size-fit-all solution, you need a seasoned DBA to look at
your requirement.
Eric Li
SQL DBA
MCDBA
Simon Harvey wrote:

> Thanks for the reply Eric,
> If anyone happens to have experience of using very large databases I would
> really appreciate any information on the sort of machines that are being
> used to run them
> Thanks all
> Simon
>
|||Thanks all.
Thats all really helpful. Cheers
Simon

How many rows can a given processor handle

Hi all,
I know this is a very general question but if anyone can give me even a
ballpark figure that would be a big help.
I have a database that in a single table has between 75 million and 150
million. These are the absolute maximum values.
The datatypes are all very simple and there is about 8 columns. This table
links to various other tables through standard relationships.
There are 6 other table.
When a join occurs, it occurs between at most, 3 tables.
My question -: Can a dual Xeon 3.06 dedicated sql server with 3Gb ram and
SCSI disks handle this dealing with 100 users at a time?
If not, could anyone suggest a spec that could
Thanks for any advice you can share
SimonWell, it all depends on what kind of joins and what other operations
needed.
Here're some estimate, 8 columns, 2 bytes each, so total 16 bytes per
row. Say it has 150 millions rows, that's
150,000,000 * 16 = 2,400,000,000 byte = 2.3 GB
Assume on average each user retrieves 1.5 millions rows (that's still
alot), then you should have enough memory to handle 100 users. CPU won't
be a problem unless you do some complicated calculations. I am more
worry about the disk performance since unless you design index right,
there may be table scans, which will really hurt the performance.
Eric Li
SQL DBA
MCDBA
Simon Harvey wrote:
> Hi all,
> I know this is a very general question but if anyone can give me even a
> ballpark figure that would be a big help.
> I have a database that in a single table has between 75 million and 150
> million. These are the absolute maximum values.
> The datatypes are all very simple and there is about 8 columns. This table
> links to various other tables through standard relationships.
> There are 6 other table.
> When a join occurs, it occurs between at most, 3 tables.
> My question -: Can a dual Xeon 3.06 dedicated sql server with 3Gb ram and
> SCSI disks handle this dealing with 100 users at a time?
> If not, could anyone suggest a spec that could
> Thanks for any advice you can share
> Simon
>|||Thanks for the reply Eric,
If anyone happens to have experience of using very large databases I would
really appreciate any information on the sort of machines that are being
used to run them
Thanks all
Simon|||here
http://www.microsoft.com/sql/evaluation/casestudies/default.asp
Bojidar Alexandrov|||and "the one"
http://www.microsoft.com/resources/casestudies/CaseStudy.asp?CaseStudyID=11205
Bojidar Alexandrov|||For a large DB, like > 100 GB DB, most of the time, disk/memory is more
a concern than CPU, unless there're alot of complicated floating point
calculations, like financial risk analysis/scientific modeling,
otherwise, a 4 CPU config. should be good enough.
Memory is cheap now, get as much as you can, I was working on a 600 GB
DB before, and it run happily on a 8 GB machine.
Get SAN if you have $$$, or RAID 10, or multiple SCSI disk controllers,
partition your DB into different file groups and put different group on
different disk, if possible. There are just too many different ways, all
depend on how big your budget is.
Or you can get multiple machines, partition your DB and chain those
machines together.
There's no one-size-fit-all solution, you need a seasoned DBA to look at
your requirement.
--
Eric Li
SQL DBA
MCDBA
Simon Harvey wrote:
> Thanks for the reply Eric,
> If anyone happens to have experience of using very large databases I would
> really appreciate any information on the sort of machines that are being
> used to run them
> Thanks all
> Simon
>|||Thanks all.
Thats all really helpful. Cheers
Simonsql

How many rows before optimizer will use index

Hi
2 questions for you Gentlemen ;-)
1:
I think I have heared that SQL Server optimizer (always ?)
will use a table scan, if the row count of a table is
under a certain value even if there exist an - othervise
appropriate - index, simply because this is considered
faster.
How many rows do a table need to have before indexes are
considered usefull - does a roughly value exist?
(I think I read the number 8000 rows once)
Is there any differences between indextypes (CL, NCL,
single/multicolumn...)in the minimum "required" row count
2:
In a table A with many rows a column colA1 exists (with
a "code type" value), referencing table B with few rows
containing the list of codes.
Though a FK (and sometimes used in queries, joins etc.)
woundn't it be superfluous to index the FK column colA1,
because of the relative bad/low selectivity of the
different domain values (both if an fairly even spread of
the different few codes are assumed or if one of the codes
are in majority).
kind regards
Jakob Persson
Denmarkactually,
SQL Server will almost always try to use an index unless
there are atleast 6-12 rows, and the plan involves a NC
index and bookmark lookups
see:
http://www.sql-server-
performance.com/jc_sql_server_quantative_analysis1.asp
for more info
2. if you don't expect a plan to use the index, it may not
be necessary. i am assuming you do not delete from table B.
>--Original Message--
>Hi
>2 questions for you Gentlemen ;-)
>1:
>I think I have heared that SQL Server optimizer
(always ?)
>will use a table scan, if the row count of a table is
>under a certain value even if there exist an - othervise
>appropriate - index, simply because this is considered
>faster.
>How many rows do a table need to have before indexes are
>considered usefull - does a roughly value exist?
>(I think I read the number 8000 rows once)
>Is there any differences between indextypes (CL, NCL,
>single/multicolumn...)in the minimum "required" row count
>2:
>In a table A with many rows a column colA1 exists (with
>a "code type" value), referencing table B with few rows
>containing the list of codes.
>Though a FK (and sometimes used in queries, joins etc.)
>woundn't it be superfluous to index the FK column colA1,
>because of the relative bad/low selectivity of the
>different domain values (both if an fairly even spread of
>the different few codes are assumed or if one of the
codes
>are in majority).
>kind regards
>Jakob Persson
>Denmark
>.
>|||Jakob Persson wrote:
<snip>
> 2:
> In a table A with many rows a column colA1 exists (with
> a "code type" value), referencing table B with few rows
> containing the list of codes.
> Though a FK (and sometimes used in queries, joins etc.)
> woundn't it be superfluous to index the FK column colA1,
> because of the relative bad/low selectivity of the
> different domain values (both if an fairly even spread of
> the different few codes are assumed or if one of the codes
> are in majority).
This is only true if the values of colA1 are evenly distributed. If the
data distribution is skewed (for example, many 'A' but few 'B'), then
the index can still be beneficial when querying on 'B'.
And (as Joe mentioned), the index is also useful when deleting rows from
the referenced table.
Gert-Jan

How many records in a table?

Hi! Stupid question as this also depends on hardware but is there a limit on
how many rows I can have in a single MSSQL 2000 table? Table consists of six
int columns and has three indexes. Is like 10 Million or 100 Million
considered to be 'normal' or unrealistic?

Thanks very much for your thoughts!

MartinMartin,

It's actually limited ONLY by hardware (disk space). I wouldn't say that 10
or 100 million are anywhere near "unrealistic". Maybe 1 trillion would be
more like it!

"Martin Feuersteiner" <theintrepidfox@.hotmail.com> wrote in message
news:cit9ft$m5b$1@.hercules.btinternet.com...
> Hi! Stupid question as this also depends on hardware but is there a limit
on
> how many rows I can have in a single MSSQL 2000 table? Table consists of
six
> int columns and has three indexes. Is like 10 Million or 100 Million
> considered to be 'normal' or unrealistic?
> Thanks very much for your thoughts!
> Martin|||Thanks!

"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:4152361a$0$2656$61fed72c@.news.rcn.com...
> Martin,
> It's actually limited ONLY by hardware (disk space). I wouldn't say that
> 10
> or 100 million are anywhere near "unrealistic". Maybe 1 trillion would be
> more like it!

Monday, March 12, 2012

How make script component output 2 asynchronous?

I am working with the Data Flow Task Script Component for the first time. I have created a second Output. In my script I add rows to this output.

I have found that Ssis does not release those rows to the second Output until it has processed all of the incomine pipeline records. This will not work for me as there are going to be a few million records coming down the pipe, so I need the Script Component to as soon as possible release these records downstream for insert into the destination component Ole Db component.

Any help would be greatly appreciated?

Hmm... I could not replicate.

How are you sending data to the 2nd output?|||

The only way I could figure to add a row to the dataset incode was to make the Synchronous property "None", to reference the Output Buffer, and then I could access the OutputBuffer.AddRow() method.

The problem is that then it tries to complete processing the entire pipeline before proceeding beyond the Script Component.

Is there a way to access the AddRow() method when the Output has the Input set as the SynchronousInput?

Here is my Script Component Code:

Code Snippet

Imports System

Imports System.Data

Imports System.Math

Imports System.Xml

Imports System.Windows.Forms

Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

Public Class ScriptMain

Inherits UserComponent

Private _Name As String

Private _Value As String

Private _Paco As String

Private _MessageId As Guid

Private _MessageStreamId As Guid

Private _LogDateTimeStamp As DateTime

Public Sub AddRow(ByVal message As String, ByVal row As Input1Buffer, ByVal xPathQuery As String, ByVal adduri As String, ByVal xPathPaco As String, ByVal removeuri As String)

If Not message Is Nothing Then

Dim doc As XmlDataDocument = New XmlDataDocument

Dim aXmlNode As XmlNode

doc.PreserveWhitespace = False

doc.LoadXml(message)

Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)

If Not removeuri Is Nothing Then namespaceManager.RemoveNamespace("ns0", removeuri)

namespaceManager.AddNamespace("ns0", adduri)

aXmlNode = doc.SelectSingleNode(xPathQuery, namespaceManager)

If Not aXmlNode Is Nothing Then

If aXmlNode.InnerText <> "0" Then

_Name = aXmlNode.Name

_Value = aXmlNode.InnerText

_MessageId = row.MessageID

_MessageStreamId = row.MessageStreamID

_LogDateTimeStamp = row.LogDateTimeStamp

aXmlNode = doc.SelectSingleNode(xPathPaco, namespaceManager)

If Not aXmlNode Is Nothing Then _Paco = aXmlNode.InnerText

CreateNewOutputRows()

End If

End If

End If

End Sub

Public Overrides Sub CreateNewOutputRows()

MyBase.CreateNewOutputRows()

With Output2Buffer

.AddRow()

.Name = _Name

.Value = _Value

.MessageId = _MessageId

.MessageStreamId = _MessageStreamId

.LogDateTimeStamp = _LogDateTimeStamp

.Paco = _Paco

End With

End Sub

Public Overrides Sub Input1_ProcessInputRow(ByVal row As Input1Buffer)

AddRow(row.StringMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringResponseMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, row.xPathPrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, row.xPathPpNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, row.xPathConNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, row.xPathEmailNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, row.xPathPhoneNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, row.xPathAddrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, Nothing)

End Sub

End Class

|||You are correct that your component should be in asynchronous mode and you should be using AddRow. You should not, however, be calling CreateNewOutputRows the way you are. The engine will call that on its own. From what I can tell of you logic, you don't need to implement it. Just move the logic you currently have in CreateNewOutputRows to where you are calling it. The AddRow method can be called from anywhere in the script, not just CreateNewOutputRows. As it is, one of your rows will be duplicated when the engine makes its call.

Regarding your concern about the script task wanting to complete the entire pipeline, you need to understand that rows do not move through the pipeline, only buffers do, and buffers consist of about 10,000 rows by default. Buffers are only ejected from a component when they are full, or the pipeline is empty. I see you have some logic filtering the incoming rows. I don't know how many incoming rows you have, or how stringent the filtering is, but if your output is less than a full buffer, then yes, it will wait until the source is finished.
|||Are you only wanting one row coming out of output 2? Or do you want a row for every input row?|||

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

|||Calling AddRow() on the 2nd output in "Public Overrides Sub Input1_ProcessInputRow" should send rows to the 2nd output without waiting for the 1st output. That's what my tests yield.|||

Dotnet Fellow wrote:

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

Yes, you can change the number of rows that go on a buffer. This will cause your buffers to fill and be ejected from your script earlier. I don't recommend it or think it is necessary, though. By default, buffers are 10,000 rows or 10 MB, whichever comes first. So memory should not be a concern. The DefaultMaxBufferRows property of the DataFlow controls the number of rows allowed on a buffer.

If you really expect to be running a million rows through this code, you may want to consider changing it so the XML documents are only loaded once for each row, instead of for each of the xpath nodes your are extracting. I count 14 document loads per row, when probably only 2 are necessary.

How make script component output 2 asynchronous?

I am working with the Data Flow Task Script Component for the first time. I have created a second Output. In my script I add rows to this output.

I have found that Ssis does not release those rows to the second Output until it has processed all of the incomine pipeline records. This will not work for me as there are going to be a few million records coming down the pipe, so I need the Script Component to as soon as possible release these records downstream for insert into the destination component Ole Db component.

Any help would be greatly appreciated?

Hmm... I could not replicate.

How are you sending data to the 2nd output?|||

The only way I could figure to add a row to the dataset incode was to make the Synchronous property "None", to reference the Output Buffer, and then I could access the OutputBuffer.AddRow() method.

The problem is that then it tries to complete processing the entire pipeline before proceeding beyond the Script Component.

Is there a way to access the AddRow() method when the Output has the Input set as the SynchronousInput?

Here is my Script Component Code:

Code Snippet

Imports System

Imports System.Data

Imports System.Math

Imports System.Xml

Imports System.Windows.Forms

Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

Public Class ScriptMain

Inherits UserComponent

Private _Name As String

Private _Value As String

Private _Paco As String

Private _MessageId As Guid

Private _MessageStreamId As Guid

Private _LogDateTimeStamp As DateTime

Public Sub AddRow(ByVal message As String, ByVal row As Input1Buffer, ByVal xPathQuery As String, ByVal adduri As String, ByVal xPathPaco As String, ByVal removeuri As String)

If Not message Is Nothing Then

Dim doc As XmlDataDocument = New XmlDataDocument

Dim aXmlNode As XmlNode

doc.PreserveWhitespace = False

doc.LoadXml(message)

Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)

If Not removeuri Is Nothing Then namespaceManager.RemoveNamespace("ns0", removeuri)

namespaceManager.AddNamespace("ns0", adduri)

aXmlNode = doc.SelectSingleNode(xPathQuery, namespaceManager)

If Not aXmlNode Is Nothing Then

If aXmlNode.InnerText <> "0" Then

_Name = aXmlNode.Name

_Value = aXmlNode.InnerText

_MessageId = row.MessageID

_MessageStreamId = row.MessageStreamID

_LogDateTimeStamp = row.LogDateTimeStamp

aXmlNode = doc.SelectSingleNode(xPathPaco, namespaceManager)

If Not aXmlNode Is Nothing Then _Paco = aXmlNode.InnerText

CreateNewOutputRows()

End If

End If

End If

End Sub

Public Overrides Sub CreateNewOutputRows()

MyBase.CreateNewOutputRows()

With Output2Buffer

.AddRow()

.Name = _Name

.Value = _Value

.MessageId = _MessageId

.MessageStreamId = _MessageStreamId

.LogDateTimeStamp = _LogDateTimeStamp

.Paco = _Paco

End With

End Sub

Public Overrides Sub Input1_ProcessInputRow(ByVal row As Input1Buffer)

AddRow(row.StringMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringResponseMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, row.xPathPrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, row.xPathPpNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, row.xPathConNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, row.xPathEmailNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, row.xPathPhoneNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, row.xPathAddrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, Nothing)

End Sub

End Class

|||You are correct that your component should be in asynchronous mode and you should be using AddRow. You should not, however, be calling CreateNewOutputRows the way you are. The engine will call that on its own. From what I can tell of you logic, you don't need to implement it. Just move the logic you currently have in CreateNewOutputRows to where you are calling it. The AddRow method can be called from anywhere in the script, not just CreateNewOutputRows. As it is, one of your rows will be duplicated when the engine makes its call.

Regarding your concern about the script task wanting to complete the entire pipeline, you need to understand that rows do not move through the pipeline, only buffers do, and buffers consist of about 10,000 rows by default. Buffers are only ejected from a component when they are full, or the pipeline is empty. I see you have some logic filtering the incoming rows. I don't know how many incoming rows you have, or how stringent the filtering is, but if your output is less than a full buffer, then yes, it will wait until the source is finished.
|||Are you only wanting one row coming out of output 2? Or do you want a row for every input row?|||

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

|||Calling AddRow() on the 2nd output in "Public Overrides Sub Input1_ProcessInputRow" should send rows to the 2nd output without waiting for the 1st output. That's what my tests yield.|||

Dotnet Fellow wrote:

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

Yes, you can change the number of rows that go on a buffer. This will cause your buffers to fill and be ejected from your script earlier. I don't recommend it or think it is necessary, though. By default, buffers are 10,000 rows or 10 MB, whichever comes first. So memory should not be a concern. The DefaultMaxBufferRows property of the DataFlow controls the number of rows allowed on a buffer.

If you really expect to be running a million rows through this code, you may want to consider changing it so the XML documents are only loaded once for each row, instead of for each of the xpath nodes your are extracting. I count 14 document loads per row, when probably only 2 are necessary.

How make script component output 2 asynchronous?

I am working with the Data Flow Task Script Component for the first time. I have created a second Output. In my script I add rows to this output.

I have found that Ssis does not release those rows to the second Output until it has processed all of the incomine pipeline records. This will not work for me as there are going to be a few million records coming down the pipe, so I need the Script Component to as soon as possible release these records downstream for insert into the destination component Ole Db component.

Any help would be greatly appreciated?

Hmm... I could not replicate.

How are you sending data to the 2nd output?|||

The only way I could figure to add a row to the dataset incode was to make the Synchronous property "None", to reference the Output Buffer, and then I could access the OutputBuffer.AddRow() method.

The problem is that then it tries to complete processing the entire pipeline before proceeding beyond the Script Component.

Is there a way to access the AddRow() method when the Output has the Input set as the SynchronousInput?

Here is my Script Component Code:

Code Snippet

Imports System

Imports System.Data

Imports System.Math

Imports System.Xml

Imports System.Windows.Forms

Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

Public Class ScriptMain

Inherits UserComponent

Private _Name As String

Private _Value As String

Private _Paco As String

Private _MessageId As Guid

Private _MessageStreamId As Guid

Private _LogDateTimeStamp As DateTime

Public Sub AddRow(ByVal message As String, ByVal row As Input1Buffer, ByVal xPathQuery As String, ByVal adduri As String, ByVal xPathPaco As String, ByVal removeuri As String)

If Not message Is Nothing Then

Dim doc As XmlDataDocument = New XmlDataDocument

Dim aXmlNode As XmlNode

doc.PreserveWhitespace = False

doc.LoadXml(message)

Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)

If Not removeuri Is Nothing Then namespaceManager.RemoveNamespace("ns0", removeuri)

namespaceManager.AddNamespace("ns0", adduri)

aXmlNode = doc.SelectSingleNode(xPathQuery, namespaceManager)

If Not aXmlNode Is Nothing Then

If aXmlNode.InnerText <> "0" Then

_Name = aXmlNode.Name

_Value = aXmlNode.InnerText

_MessageId = row.MessageID

_MessageStreamId = row.MessageStreamID

_LogDateTimeStamp = row.LogDateTimeStamp

aXmlNode = doc.SelectSingleNode(xPathPaco, namespaceManager)

If Not aXmlNode Is Nothing Then _Paco = aXmlNode.InnerText

CreateNewOutputRows()

End If

End If

End If

End Sub

Public Overrides Sub CreateNewOutputRows()

MyBase.CreateNewOutputRows()

With Output2Buffer

.AddRow()

.Name = _Name

.Value = _Value

.MessageId = _MessageId

.MessageStreamId = _MessageStreamId

.LogDateTimeStamp = _LogDateTimeStamp

.Paco = _Paco

End With

End Sub

Public Overrides Sub Input1_ProcessInputRow(ByVal row As Input1Buffer)

AddRow(row.StringMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringResponseMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, row.xPathPrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, row.xPathPpNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, row.xPathConNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, row.xPathEmailNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, row.xPathPhoneNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, row.xPathAddrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, Nothing)

End Sub

End Class

|||You are correct that your component should be in asynchronous mode and you should be using AddRow. You should not, however, be calling CreateNewOutputRows the way you are. The engine will call that on its own. From what I can tell of you logic, you don't need to implement it. Just move the logic you currently have in CreateNewOutputRows to where you are calling it. The AddRow method can be called from anywhere in the script, not just CreateNewOutputRows. As it is, one of your rows will be duplicated when the engine makes its call.

Regarding your concern about the script task wanting to complete the entire pipeline, you need to understand that rows do not move through the pipeline, only buffers do, and buffers consist of about 10,000 rows by default. Buffers are only ejected from a component when they are full, or the pipeline is empty. I see you have some logic filtering the incoming rows. I don't know how many incoming rows you have, or how stringent the filtering is, but if your output is less than a full buffer, then yes, it will wait until the source is finished.
|||Are you only wanting one row coming out of output 2? Or do you want a row for every input row?|||

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

|||Calling AddRow() on the 2nd output in "Public Overrides Sub Input1_ProcessInputRow" should send rows to the 2nd output without waiting for the 1st output. That's what my tests yield.|||

Dotnet Fellow wrote:

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

Yes, you can change the number of rows that go on a buffer. This will cause your buffers to fill and be ejected from your script earlier. I don't recommend it or think it is necessary, though. By default, buffers are 10,000 rows or 10 MB, whichever comes first. So memory should not be a concern. The DefaultMaxBufferRows property of the DataFlow controls the number of rows allowed on a buffer.

If you really expect to be running a million rows through this code, you may want to consider changing it so the XML documents are only loaded once for each row, instead of for each of the xpath nodes your are extracting. I count 14 document loads per row, when probably only 2 are necessary.

How make script component output 2 asynchronous?

I am working with the Data Flow Task Script Component for the first time. I have created a second Output. In my script I add rows to this output.

I have found that Ssis does not release those rows to the second Output until it has processed all of the incomine pipeline records. This will not work for me as there are going to be a few million records coming down the pipe, so I need the Script Component to as soon as possible release these records downstream for insert into the destination component Ole Db component.

Any help would be greatly appreciated?

Hmm... I could not replicate.

How are you sending data to the 2nd output?|||

The only way I could figure to add a row to the dataset incode was to make the Synchronous property "None", to reference the Output Buffer, and then I could access the OutputBuffer.AddRow() method.

The problem is that then it tries to complete processing the entire pipeline before proceeding beyond the Script Component.

Is there a way to access the AddRow() method when the Output has the Input set as the SynchronousInput?

Here is my Script Component Code:

Code Snippet

Imports System

Imports System.Data

Imports System.Math

Imports System.Xml

Imports System.Windows.Forms

Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

Public Class ScriptMain

Inherits UserComponent

Private _Name As String

Private _Value As String

Private _Paco As String

Private _MessageId As Guid

Private _MessageStreamId As Guid

Private _LogDateTimeStamp As DateTime

Public Sub AddRow(ByVal message As String, ByVal row As Input1Buffer, ByVal xPathQuery As String, ByVal adduri As String, ByVal xPathPaco As String, ByVal removeuri As String)

If Not message Is Nothing Then

Dim doc As XmlDataDocument = New XmlDataDocument

Dim aXmlNode As XmlNode

doc.PreserveWhitespace = False

doc.LoadXml(message)

Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)

If Not removeuri Is Nothing Then namespaceManager.RemoveNamespace("ns0", removeuri)

namespaceManager.AddNamespace("ns0", adduri)

aXmlNode = doc.SelectSingleNode(xPathQuery, namespaceManager)

If Not aXmlNode Is Nothing Then

If aXmlNode.InnerText <> "0" Then

_Name = aXmlNode.Name

_Value = aXmlNode.InnerText

_MessageId = row.MessageID

_MessageStreamId = row.MessageStreamID

_LogDateTimeStamp = row.LogDateTimeStamp

aXmlNode = doc.SelectSingleNode(xPathPaco, namespaceManager)

If Not aXmlNode Is Nothing Then _Paco = aXmlNode.InnerText

CreateNewOutputRows()

End If

End If

End If

End Sub

Public Overrides Sub CreateNewOutputRows()

MyBase.CreateNewOutputRows()

With Output2Buffer

.AddRow()

.Name = _Name

.Value = _Value

.MessageId = _MessageId

.MessageStreamId = _MessageStreamId

.LogDateTimeStamp = _LogDateTimeStamp

.Paco = _Paco

End With

End Sub

Public Overrides Sub Input1_ProcessInputRow(ByVal row As Input1Buffer)

AddRow(row.StringMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringResponseMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, row.xPathPrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, row.xPathPpNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, row.xPathConNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, row.xPathEmailNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, row.xPathPhoneNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, row.xPathAddrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, Nothing)

End Sub

End Class

|||You are correct that your component should be in asynchronous mode and you should be using AddRow. You should not, however, be calling CreateNewOutputRows the way you are. The engine will call that on its own. From what I can tell of you logic, you don't need to implement it. Just move the logic you currently have in CreateNewOutputRows to where you are calling it. The AddRow method can be called from anywhere in the script, not just CreateNewOutputRows. As it is, one of your rows will be duplicated when the engine makes its call.

Regarding your concern about the script task wanting to complete the entire pipeline, you need to understand that rows do not move through the pipeline, only buffers do, and buffers consist of about 10,000 rows by default. Buffers are only ejected from a component when they are full, or the pipeline is empty. I see you have some logic filtering the incoming rows. I don't know how many incoming rows you have, or how stringent the filtering is, but if your output is less than a full buffer, then yes, it will wait until the source is finished.
|||Are you only wanting one row coming out of output 2? Or do you want a row for every input row?|||

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

|||Calling AddRow() on the 2nd output in "Public Overrides Sub Input1_ProcessInputRow" should send rows to the 2nd output without waiting for the 1st output. That's what my tests yield.|||

Dotnet Fellow wrote:

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

Yes, you can change the number of rows that go on a buffer. This will cause your buffers to fill and be ejected from your script earlier. I don't recommend it or think it is necessary, though. By default, buffers are 10,000 rows or 10 MB, whichever comes first. So memory should not be a concern. The DefaultMaxBufferRows property of the DataFlow controls the number of rows allowed on a buffer.

If you really expect to be running a million rows through this code, you may want to consider changing it so the XML documents are only loaded once for each row, instead of for each of the xpath nodes your are extracting. I count 14 document loads per row, when probably only 2 are necessary.

How make script component output 2 asynchronous?

I am working with the Data Flow Task Script Component for the first time. I have created a second Output. In my script I add rows to this output.

I have found that Ssis does not release those rows to the second Output until it has processed all of the incomine pipeline records. This will not work for me as there are going to be a few million records coming down the pipe, so I need the Script Component to as soon as possible release these records downstream for insert into the destination component Ole Db component.

Any help would be greatly appreciated?

Hmm... I could not replicate.

How are you sending data to the 2nd output?|||

The only way I could figure to add a row to the dataset incode was to make the Synchronous property "None", to reference the Output Buffer, and then I could access the OutputBuffer.AddRow() method.

The problem is that then it tries to complete processing the entire pipeline before proceeding beyond the Script Component.

Is there a way to access the AddRow() method when the Output has the Input set as the SynchronousInput?

Here is my Script Component Code:

Code Snippet

Imports System

Imports System.Data

Imports System.Math

Imports System.Xml

Imports System.Windows.Forms

Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

Public Class ScriptMain

Inherits UserComponent

Private _Name As String

Private _Value As String

Private _Paco As String

Private _MessageId As Guid

Private _MessageStreamId As Guid

Private _LogDateTimeStamp As DateTime

Public Sub AddRow(ByVal message As String, ByVal row As Input1Buffer, ByVal xPathQuery As String, ByVal adduri As String, ByVal xPathPaco As String, ByVal removeuri As String)

If Not message Is Nothing Then

Dim doc As XmlDataDocument = New XmlDataDocument

Dim aXmlNode As XmlNode

doc.PreserveWhitespace = False

doc.LoadXml(message)

Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)

If Not removeuri Is Nothing Then namespaceManager.RemoveNamespace("ns0", removeuri)

namespaceManager.AddNamespace("ns0", adduri)

aXmlNode = doc.SelectSingleNode(xPathQuery, namespaceManager)

If Not aXmlNode Is Nothing Then

If aXmlNode.InnerText <> "0" Then

_Name = aXmlNode.Name

_Value = aXmlNode.InnerText

_MessageId = row.MessageID

_MessageStreamId = row.MessageStreamID

_LogDateTimeStamp = row.LogDateTimeStamp

aXmlNode = doc.SelectSingleNode(xPathPaco, namespaceManager)

If Not aXmlNode Is Nothing Then _Paco = aXmlNode.InnerText

CreateNewOutputRows()

End If

End If

End If

End Sub

Public Overrides Sub CreateNewOutputRows()

MyBase.CreateNewOutputRows()

With Output2Buffer

.AddRow()

.Name = _Name

.Value = _Value

.MessageId = _MessageId

.MessageStreamId = _MessageStreamId

.LogDateTimeStamp = _LogDateTimeStamp

.Paco = _Paco

End With

End Sub

Public Overrides Sub Input1_ProcessInputRow(ByVal row As Input1Buffer)

AddRow(row.StringMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringResponseMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, row.xPathPrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, row.xPathPpNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, row.xPathConNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, row.xPathEmailNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, row.xPathPhoneNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, row.xPathAddrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, Nothing)

End Sub

End Class

|||You are correct that your component should be in asynchronous mode and you should be using AddRow. You should not, however, be calling CreateNewOutputRows the way you are. The engine will call that on its own. From what I can tell of you logic, you don't need to implement it. Just move the logic you currently have in CreateNewOutputRows to where you are calling it. The AddRow method can be called from anywhere in the script, not just CreateNewOutputRows. As it is, one of your rows will be duplicated when the engine makes its call.

Regarding your concern about the script task wanting to complete the entire pipeline, you need to understand that rows do not move through the pipeline, only buffers do, and buffers consist of about 10,000 rows by default. Buffers are only ejected from a component when they are full, or the pipeline is empty. I see you have some logic filtering the incoming rows. I don't know how many incoming rows you have, or how stringent the filtering is, but if your output is less than a full buffer, then yes, it will wait until the source is finished.
|||Are you only wanting one row coming out of output 2? Or do you want a row for every input row?|||

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

|||Calling AddRow() on the 2nd output in "Public Overrides Sub Input1_ProcessInputRow" should send rows to the 2nd output without waiting for the 1st output. That's what my tests yield.|||

Dotnet Fellow wrote:

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

Yes, you can change the number of rows that go on a buffer. This will cause your buffers to fill and be ejected from your script earlier. I don't recommend it or think it is necessary, though. By default, buffers are 10,000 rows or 10 MB, whichever comes first. So memory should not be a concern. The DefaultMaxBufferRows property of the DataFlow controls the number of rows allowed on a buffer.

If you really expect to be running a million rows through this code, you may want to consider changing it so the XML documents are only loaded once for each row, instead of for each of the xpath nodes your are extracting. I count 14 document loads per row, when probably only 2 are necessary.

How make script component output 2 asynchronous?

I am working with the Data Flow Task Script Component for the first time. I have created a second Output. In my script I add rows to this output.

I have found that Ssis does not release those rows to the second Output until it has processed all of the incomine pipeline records. This will not work for me as there are going to be a few million records coming down the pipe, so I need the Script Component to as soon as possible release these records downstream for insert into the destination component Ole Db component.

Any help would be greatly appreciated?

Hmm... I could not replicate.

How are you sending data to the 2nd output?|||

The only way I could figure to add a row to the dataset incode was to make the Synchronous property "None", to reference the Output Buffer, and then I could access the OutputBuffer.AddRow() method.

The problem is that then it tries to complete processing the entire pipeline before proceeding beyond the Script Component.

Is there a way to access the AddRow() method when the Output has the Input set as the SynchronousInput?

Here is my Script Component Code:

Code Snippet

Imports System

Imports System.Data

Imports System.Math

Imports System.Xml

Imports System.Windows.Forms

Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

Public Class ScriptMain

Inherits UserComponent

Private _Name As String

Private _Value As String

Private _Paco As String

Private _MessageId As Guid

Private _MessageStreamId As Guid

Private _LogDateTimeStamp As DateTime

Public Sub AddRow(ByVal message As String, ByVal row As Input1Buffer, ByVal xPathQuery As String, ByVal adduri As String, ByVal xPathPaco As String, ByVal removeuri As String)

If Not message Is Nothing Then

Dim doc As XmlDataDocument = New XmlDataDocument

Dim aXmlNode As XmlNode

doc.PreserveWhitespace = False

doc.LoadXml(message)

Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)

If Not removeuri Is Nothing Then namespaceManager.RemoveNamespace("ns0", removeuri)

namespaceManager.AddNamespace("ns0", adduri)

aXmlNode = doc.SelectSingleNode(xPathQuery, namespaceManager)

If Not aXmlNode Is Nothing Then

If aXmlNode.InnerText <> "0" Then

_Name = aXmlNode.Name

_Value = aXmlNode.InnerText

_MessageId = row.MessageID

_MessageStreamId = row.MessageStreamID

_LogDateTimeStamp = row.LogDateTimeStamp

aXmlNode = doc.SelectSingleNode(xPathPaco, namespaceManager)

If Not aXmlNode Is Nothing Then _Paco = aXmlNode.InnerText

CreateNewOutputRows()

End If

End If

End If

End Sub

Public Overrides Sub CreateNewOutputRows()

MyBase.CreateNewOutputRows()

With Output2Buffer

.AddRow()

.Name = _Name

.Value = _Value

.MessageId = _MessageId

.MessageStreamId = _MessageStreamId

.LogDateTimeStamp = _LogDateTimeStamp

.Paco = _Paco

End With

End Sub

Public Overrides Sub Input1_ProcessInputRow(ByVal row As Input1Buffer)

AddRow(row.StringMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringResponseMessageBody, row, row.xPathPrId, row.xPathPrNamespace, row.xPathPrPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, row.xPathPrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPpId, row.xPathPpNamespace, row.xPathPpPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, row.xPathPpNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathConId, row.xPathConNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, row.xPathConNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathEmailId, row.xPathEmailNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, row.xPathEmailNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPhoneId, row.xPathPhoneNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, row.xPathPhoneNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathAddrId, row.xPathAddrNamespace, row.xPathConPaco, Nothing)

AddRow(row.StringMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, row.xPathAddrNamespace)

AddRow(row.StringResponseMessageBody, row, row.xPathPtId, row.xPathPtNamespace, row.xPathConPaco, Nothing)

End Sub

End Class

|||You are correct that your component should be in asynchronous mode and you should be using AddRow. You should not, however, be calling CreateNewOutputRows the way you are. The engine will call that on its own. From what I can tell of you logic, you don't need to implement it. Just move the logic you currently have in CreateNewOutputRows to where you are calling it. The AddRow method can be called from anywhere in the script, not just CreateNewOutputRows. As it is, one of your rows will be duplicated when the engine makes its call.

Regarding your concern about the script task wanting to complete the entire pipeline, you need to understand that rows do not move through the pipeline, only buffers do, and buffers consist of about 10,000 rows by default. Buffers are only ejected from a component when they are full, or the pipeline is empty. I see you have some logic filtering the incoming rows. I don't know how many incoming rows you have, or how stringent the filtering is, but if your output is less than a full buffer, then yes, it will wait until the source is finished.
|||Are you only wanting one row coming out of output 2? Or do you want a row for every input row?|||

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

|||Calling AddRow() on the 2nd output in "Public Overrides Sub Input1_ProcessInputRow" should send rows to the 2nd output without waiting for the 1st output. That's what my tests yield.|||

Dotnet Fellow wrote:

Can I set the count of rows to cause the buffer to push the data downstream?

Each row that comes in contains an Xml document from which I am harvesting certain node values and sticking them into a structured table.

I originally did not use the CreateNewOutputRows. This was one attempt I made at trying to force the buffer data down through the pipeline. I am encountering the same results with or without the use of CreateNewOutputRows.

Again, my experience was that the script component was not pushing the output down the pipeline. My fear was/is that when I am processing millions of rows it will fill the Ssis Engine Memory space up before it pushes data down the pipeline.

Perhaps if I could set the count at which I want it to push data down the pipeline? Is that possible?

Yes, you can change the number of rows that go on a buffer. This will cause your buffers to fill and be ejected from your script earlier. I don't recommend it or think it is necessary, though. By default, buffers are 10,000 rows or 10 MB, whichever comes first. So memory should not be a concern. The DefaultMaxBufferRows property of the DataFlow controls the number of rows allowed on a buffer.

If you really expect to be running a million rows through this code, you may want to consider changing it so the XML documents are only loaded once for each row, instead of for each of the xpath nodes your are extracting. I count 14 document loads per row, when probably only 2 are necessary.

How long it take to finish replicate data

I have a database A include five tables, and have more than 1,500,000 rows. There is a replica database of A. First of all, there is no data in the two dbs. When I finish inserting data into A, the replica db seems still work, the log file size still changes. How can I know the replication finished or not? How long it will take to finish replicate 1,500,000 rows of data?Is this transactional replication or merge? If it is transactional you can use select * from distribution.dbo.msdistribution_status to determine how many of the rows have been replicated.

How long does it take to drop a FT index?

Yesterday I created a full text index on a single field in my database with
365000 rows in order to do some performance testing to see if moving to a
full text index would provide significant improvement over LIKE clauses for
looking up words in titles of products. I now need to create indexes on a
couple more rows, and so I need to drop the existing index and create a new
one. However, it's now 3 hours later and iSQL is still running my drop
statement. How long does it normally take to drop a full text index of 98045
unique words with 364704 items, totalling 13MB? If I right click on the
catalog in SQL Ent Manager and choose Properties it shows the catalog as
idle. No errors are being returned by iSQL, and there is nothing in either
the W2K Event Log or the SQL log to indicate there is a problem. Please help
:|
Dan
This should happen well within a minute. run sp_lock to see if there is any
locking.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Daniel Crichton" <msnews@.worldofspack.co.uk> wrote in message
news:emlT0SGrEHA.868@.TK2MSFTNGP10.phx.gbl...
> Yesterday I created a full text index on a single field in my database
with
> 365000 rows in order to do some performance testing to see if moving to a
> full text index would provide significant improvement over LIKE clauses
for
> looking up words in titles of products. I now need to create indexes on a
> couple more rows, and so I need to drop the existing index and create a
new
> one. However, it's now 3 hours later and iSQL is still running my drop
> statement. How long does it normally take to drop a full text index of
98045
> unique words with 364704 items, totalling 13MB? If I right click on the
> catalog in SQL Ent Manager and choose Properties it shows the catalog as
> idle. No errors are being returned by iSQL, and there is nothing in either
> the W2K Event Log or the SQL log to indicate there is a problem. Please
help
> :|
> Dan
>
|||"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:eX8NLVGrEHA.896@.TK2MSFTNGP12.phx.gbl...
> This should happen well within a minute. run sp_lock to see if there is
any
> locking.
I knew I'd forgotten to do something :|
Thanks for the help. I found a stuck connection from a process that ran a
9:26 last night that for reason hadn't cleared - the process ended after
only a few seconds, yet SQL Server was maintaining the lock. In the end I
had to restart the SQL Server service to get rid of it, then the index
dropped in 5 seconds.
Dan
|||You have to be very careful with locking. SQL FTS does apply row level
locking while doing populations which can aggravate deadlocks and
maintenance operations like the one you have discovered.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Daniel Crichton" <msnews@.worldofspack.co.uk> wrote in message
news:eSpySqGrEHA.452@.TK2MSFTNGP09.phx.gbl...
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:eX8NLVGrEHA.896@.TK2MSFTNGP12.phx.gbl...
> any
> I knew I'd forgotten to do something :|
> Thanks for the help. I found a stuck connection from a process that ran a
> 9:26 last night that for reason hadn't cleared - the process ended after
> only a few seconds, yet SQL Server was maintaining the lock. In the end I
> had to restart the SQL Server service to get rid of it, then the index
> dropped in 5 seconds.
> Dan
>

Friday, March 9, 2012

How keep together table rows?

Is it possinle to keep together few table rows?

It's not very good, when detail data and group footer was printed on different pages..

Hi,

Use the KeepTogether property of your table.

Best, Radu.

Wednesday, March 7, 2012

How is sysindexes.rows updated by SQL Server?

I know that the rows column on sysindexes is not always accurate, and
that I can force and update by using DBCC UPDATEUSAGE, but I'm
wondering what happens "behind the scenes" so that this value is
eventually updated with the correct value.
The particular example that I'm working with is this: a developer
noticed that the rows property on the table pop-up in EM doesn't match
the actual row count. I explained to him why the values didn't match,
but I have to believe that eventually this value will be changed and
EM will report the accurate row count. Is this correct?
Thanks in advance!
Maria
One thing that corrects the value is DBCC CHECKDB (which I assume that you run regularly).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Maria Vogel" <vogelm@.meijer.com> wrote in message news:1715eae1.0405110654.460c627@.posting.google.co m...
> I know that the rows column on sysindexes is not always accurate, and
> that I can force and update by using DBCC UPDATEUSAGE, but I'm
> wondering what happens "behind the scenes" so that this value is
> eventually updated with the correct value.
> The particular example that I'm working with is this: a developer
> noticed that the rows property on the table pop-up in EM doesn't match
> the actual row count. I explained to him why the values didn't match,
> but I have to believe that eventually this value will be changed and
> EM will report the accurate row count. Is this correct?
> Thanks in advance!
> Maria
|||Tibor, no it doesn't. Only DBCC UPDATEUSAGE does it.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:evWisr$NEHA.3596@.tk2msftngp13.phx.gbl...
> One thing that corrects the value is DBCC CHECKDB (which I assume that you
run regularly).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
> "Maria Vogel" <vogelm@.meijer.com> wrote in message
news:1715eae1.0405110654.460c627@.posting.google.co m...
>
|||Ahh, thanks Paul. I didn't know that was changed since the old days (I still recall 6.5, where only way to
adjust space allocation for syslogs was through CHECKDB...). :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Paul S Randal [MS]" <prandal@.online.microsoft.com> wrote in message
news:%23OrDTGFOEHA.1104@.TK2MSFTNGP10.phx.gbl...
> Tibor, no it doesn't. Only DBCC UPDATEUSAGE does it.
> --
> Paul Randal
> Dev Lead, Microsoft SQL Server Storage Engine
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:evWisr$NEHA.3596@.tk2msftngp13.phx.gbl...
> run regularly).
> news:1715eae1.0405110654.460c627@.posting.google.co m...
>

How is sysindexes.rows updated by SQL Server?

I know that the rows column on sysindexes is not always accurate, and
that I can force and update by using DBCC UPDATEUSAGE, but I'm
wondering what happens "behind the scenes" so that this value is
eventually updated with the correct value.
The particular example that I'm working with is this: a developer
noticed that the rows property on the table pop-up in EM doesn't match
the actual row count. I explained to him why the values didn't match,
but I have to believe that eventually this value will be changed and
EM will report the accurate row count. Is this correct?
Thanks in advance!
MariaOne thing that corrects the value is DBCC CHECKDB (which I assume that you r
un regularly).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Maria Vogel" <vogelm@.meijer.com> wrote in message news:1715eae1.0405110654.460c627@.posting.
google.com...
> I know that the rows column on sysindexes is not always accurate, and
> that I can force and update by using DBCC UPDATEUSAGE, but I'm
> wondering what happens "behind the scenes" so that this value is
> eventually updated with the correct value.
> The particular example that I'm working with is this: a developer
> noticed that the rows property on the table pop-up in EM doesn't match
> the actual row count. I explained to him why the values didn't match,
> but I have to believe that eventually this value will be changed and
> EM will report the accurate row count. Is this correct?
> Thanks in advance!
> Maria|||Tibor, no it doesn't. Only DBCC UPDATEUSAGE does it.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:evWisr$NEHA.3596@.tk2msftngp13.phx.gbl...
> One thing that corrects the value is DBCC CHECKDB (which I assume that you
run regularly).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
> "Maria Vogel" <vogelm@.meijer.com> wrote in message
news:1715eae1.0405110654.460c627@.posting.google.com...
>|||Ahh, thanks Paul. I didn't know that was changed since the old days (I still
recall 6.5, where only way to
adjust space allocation for syslogs was through CHECKDB...). :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Paul S Randal [MS]" <prandal@.online.microsoft.com> wrote in message
news:%23OrDTGFOEHA.1104@.TK2MSFTNGP10.phx.gbl...
> Tibor, no it doesn't. Only DBCC UPDATEUSAGE does it.
> --
> Paul Randal
> Dev Lead, Microsoft SQL Server Storage Engine
> This posting is provided "AS IS" with no warranties, and confers no rights
.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:evWisr$NEHA.3596@.tk2msftngp13.phx.gbl...
> run regularly).
> news:1715eae1.0405110654.460c627@.posting.google.com...
>

How is sysindexes.rows updated by SQL Server?

I know that the rows column on sysindexes is not always accurate, and
that I can force and update by using DBCC UPDATEUSAGE, but I'm
wondering what happens "behind the scenes" so that this value is
eventually updated with the correct value.
The particular example that I'm working with is this: a developer
noticed that the rows property on the table pop-up in EM doesn't match
the actual row count. I explained to him why the values didn't match,
but I have to believe that eventually this value will be changed and
EM will report the accurate row count. Is this correct?
Thanks in advance!
MariaOne thing that corrects the value is DBCC CHECKDB (which I assume that you run regularly).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Maria Vogel" <vogelm@.meijer.com> wrote in message news:1715eae1.0405110654.460c627@.posting.google.com...
> I know that the rows column on sysindexes is not always accurate, and
> that I can force and update by using DBCC UPDATEUSAGE, but I'm
> wondering what happens "behind the scenes" so that this value is
> eventually updated with the correct value.
> The particular example that I'm working with is this: a developer
> noticed that the rows property on the table pop-up in EM doesn't match
> the actual row count. I explained to him why the values didn't match,
> but I have to believe that eventually this value will be changed and
> EM will report the accurate row count. Is this correct?
> Thanks in advance!
> Maria|||Tibor, no it doesn't. Only DBCC UPDATEUSAGE does it.
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:evWisr$NEHA.3596@.tk2msftngp13.phx.gbl...
> One thing that corrects the value is DBCC CHECKDB (which I assume that you
run regularly).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
> "Maria Vogel" <vogelm@.meijer.com> wrote in message
news:1715eae1.0405110654.460c627@.posting.google.com...
> > I know that the rows column on sysindexes is not always accurate, and
> > that I can force and update by using DBCC UPDATEUSAGE, but I'm
> > wondering what happens "behind the scenes" so that this value is
> > eventually updated with the correct value.
> >
> > The particular example that I'm working with is this: a developer
> > noticed that the rows property on the table pop-up in EM doesn't match
> > the actual row count. I explained to him why the values didn't match,
> > but I have to believe that eventually this value will be changed and
> > EM will report the accurate row count. Is this correct?
> >
> > Thanks in advance!
> > Maria
>|||Ahh, thanks Paul. I didn't know that was changed since the old days (I still recall 6.5, where only way to
adjust space allocation for syslogs was through CHECKDB...). :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Paul S Randal [MS]" <prandal@.online.microsoft.com> wrote in message
news:%23OrDTGFOEHA.1104@.TK2MSFTNGP10.phx.gbl...
> Tibor, no it doesn't. Only DBCC UPDATEUSAGE does it.
> --
> Paul Randal
> Dev Lead, Microsoft SQL Server Storage Engine
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:evWisr$NEHA.3596@.tk2msftngp13.phx.gbl...
> > One thing that corrects the value is DBCC CHECKDB (which I assume that you
> run regularly).
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> >
> >
> > "Maria Vogel" <vogelm@.meijer.com> wrote in message
> news:1715eae1.0405110654.460c627@.posting.google.com...
> > > I know that the rows column on sysindexes is not always accurate, and
> > > that I can force and update by using DBCC UPDATEUSAGE, but I'm
> > > wondering what happens "behind the scenes" so that this value is
> > > eventually updated with the correct value.
> > >
> > > The particular example that I'm working with is this: a developer
> > > noticed that the rows property on the table pop-up in EM doesn't match
> > > the actual row count. I explained to him why the values didn't match,
> > > but I have to believe that eventually this value will be changed and
> > > EM will report the accurate row count. Is this correct?
> > >
> > > Thanks in advance!
> > > Maria
> >
> >
>

Friday, February 24, 2012

How I do to eliminate duplicate rows?

Hello,
I need to eliminate the duplicated rows in sql server 2000, but the duplicate is only for some fields of the row. However, I need all the fields of the row. For example, I have the next structure:
Id_type, number_type, date, diagnosis, sex, age, city

After many analysis I get many rows where the tree first field are repeated, so I need to leave only one but with the all another fields. This is because I need only the first time when the diagnosis appear.

How I can do it?

Thank you very much.

Regards,
Angela

As I understand you issue, when there are rows that have the same values for (ID_Type, Number_Type, Date), you wish to keep ONLY one (1) row, and it doens't matter which one of the duplicated rows is kept.

What if the non-duplicated fields is different, i.e., different diagnosis, or different sex, or different age, or different city (if that could happen)?

There are several methods to accomplish this task. First, a little more information is useful:

Version of SQL Server?

Are there other tables that have foreign key relationships to this table?

Approximately how much data is in the table (rows)?

Are there periods of time when no one is using the table?

Send this information and we can better assist you.

|||Hi Arnie, thanks you for your response.

Well, the problem is the information is the very bad quality .... so, I suppose that I get one row to the first time that some diagnosis appear to the pacient, but with data this not happen. So

I have found that to the same ID_Type, Number_Type, Date and same diagnosis exists rows that they have different sex or age or any other field, so I need to select only one, because I need the first time that this diagnosis appears...

Let me to response the questions:

Version of SQL Server?

R: Sql server 2000

Are there other tables that have foreign key relationships to this table?

R: yes, because some fields are only codes

Approximately how much data is in the table (rows)?

R: this table have 25 millions of rows... so much...

Are there periods of time when no one is using the table?

R: yes, this table is to datamining exercise.

I appreciate so much your help.

|||This kb should help:
http://support.microsoft.com/kb/139444|||

Here is an article that provides a bit more detailed instructions that the kb article.

http://www.sql-server-performance.com/rd_delete_duplicates.asp

One issue that neither article touches on is the size of your table. If there are many duplicates, attempting to work on the entire table could be a major struggle for your server due to the amount of Transaction Log activity and locks that will be required. You may find it more efficient to work with batches of, say 50,000 rows at a time. If there is a large amount of delete activity, there may be some Transaction Log issues that would have to be addressed.

|||

Thaks a lot, both articles are very nice....

Regards,

Angela