Showing posts with label number. Show all posts
Showing posts with label number. Show all posts

Friday, March 30, 2012

Page break after X items

Is it possible to force a page break after a specified number of items in a table?
For instance, I have a name badge report but I'm running into a problem where some badges are sliced down the middle at page breaks when exporting to pdf or tiff. If I could force a page break after every 2nd or 3rd badge it would alleviate that problem.

Thanks in advance.Figured it out. I added a group on Code.GetCount(RowNumber(Nothing)) with a page break at the end and added this function:


public shared function GetCount(CurrentCount As Integer) As Integer
If CurrentCount Mod 2 = 0 Then
GetCount = CurrentCount-1
Else
GetCount = CurrentCount
End If
end function

|||

Hello Nblankton

that was a very good idea, I did try to use it but for some reason it only works with 2 records.

I tried to change it with Mod 4 (I thought that would break after 4 records but that is not the case, I page break after the 1,2 and 4th record).

I'm not sure if I'm missing something or it is a bug.

Any Idea?

Thank you

MQ

|||

You'd also need to also alter the CurrentCode-1 line to subtract the appropriate number so that for all four that returned number is the same.

Something like CurrentCode-(CurrentCode Mod 4)+1.

I worked out a different method later that I think is a little clearer, though. This groups by 3's:

public shared function GetCount(CurrentCount As Integer) As Integer
GetCount = (CurrentCount+1)/3
end function

|||

Hi Nblankton

thank you for the response, after I wrote the note I searched the forum and found this

"=Ceiling(RowNumber(Nothing)/4)" you can put any number (2,5,20) it works, without having to add any code.

Thank you for your help. adding a group to control the amount of record per page is a great idea.

MQ

|||hi, I hope someone can help me!
I don't understand where I must place "=Ceiling(RowNumber(Nothing)/4)"

I added a new group (I selected table, right-click Proprieties, groups and add)
and I've write "=Ceiling(RowNumber(Nothing)/4)" as expression, but when I tried to execute , an error rose!
A scope problem

did I wrong the place to write the expression?

Thanks in advance
sql

Page break after X items

Is it possible to force a page break after a specified number of items in a table?
For instance, I have a name badge report but I'm running into a problem where some badges are sliced down the middle at page breaks when exporting to pdf or tiff. If I could force a page break after every 2nd or 3rd badge it would alleviate that problem.

Thanks in advance.Figured it out. I added a group on Code.GetCount(RowNumber(Nothing)) with a page break at the end and added this function:


public shared function GetCount(CurrentCount As Integer) As Integer
If CurrentCount Mod 2 = 0 Then
GetCount = CurrentCount-1
Else
GetCount = CurrentCount
End If
end function

|||

Hello Nblankton

that was a very good idea, I did try to use it but for some reason it only works with 2 records.

I tried to change it with Mod 4 (I thought that would break after 4 records but that is not the case, I page break after the 1,2 and 4th record).

I'm not sure if I'm missing something or it is a bug.

Any Idea?

Thank you

MQ

|||

You'd also need to also alter the CurrentCode-1 line to subtract the appropriate number so that for all four that returned number is the same.

Something like CurrentCode-(CurrentCode Mod 4)+1.

I worked out a different method later that I think is a little clearer, though. This groups by 3's:

public shared function GetCount(CurrentCount As Integer) As Integer
GetCount = (CurrentCount+1)/3
end function

|||

Hi Nblankton

thank you for the response, after I wrote the note I searched the forum and found this

"=Ceiling(RowNumber(Nothing)/4)" you can put any number (2,5,20) it works, without having to add any code.

Thank you for your help. adding a group to control the amount of record per page is a great idea.

MQ

|||hi, I hope someone can help me!
I don't understand where I must place "=Ceiling(RowNumber(Nothing)/4)"

I added a new group (I selected table, right-click Proprieties, groups and add)
and I've write "=Ceiling(RowNumber(Nothing)/4)" as expression, but when I tried to execute , an error rose!
A scope problem

did I wrong the place to write the expression?

Thanks in advance

Page break after X items

Is it possible to force a page break after a specified number of items in a table?
For instance, I have a name badge report but I'm running into a problem where some badges are sliced down the middle at page breaks when exporting to pdf or tiff. If I could force a page break after every 2nd or 3rd badge it would alleviate that problem.

Thanks in advance.Figured it out. I added a group on Code.GetCount(RowNumber(Nothing)) with a page break at the end and added this function:


public shared function GetCount(CurrentCount As Integer) As Integer
If CurrentCount Mod 2 = 0 Then
GetCount = CurrentCount-1
Else
GetCount = CurrentCount
End If
end function

|||

Hello Nblankton

that was a very good idea, I did try to use it but for some reason it only works with 2 records.

I tried to change it with Mod 4 (I thought that would break after 4 records but that is not the case, I page break after the 1,2 and 4th record).

I'm not sure if I'm missing something or it is a bug.

Any Idea?

Thank you

MQ

|||

You'd also need to also alter the CurrentCode-1 line to subtract the appropriate number so that for all four that returned number is the same.

Something like CurrentCode-(CurrentCode Mod 4)+1.

I worked out a different method later that I think is a little clearer, though. This groups by 3's:

public shared function GetCount(CurrentCount As Integer) As Integer
GetCount = (CurrentCount+1)/3
end function

|||

Hi Nblankton

thank you for the response, after I wrote the note I searched the forum and found this

"=Ceiling(RowNumber(Nothing)/4)" you can put any number (2,5,20) it works, without having to add any code.

Thank you for your help. adding a group to control the amount of record per page is a great idea.

MQ

|||hi, I hope someone can help me!
I don't understand where I must place "=Ceiling(RowNumber(Nothing)/4)"

I added a new group (I selected table, right-click Proprieties, groups and add)
and I've write "=Ceiling(RowNumber(Nothing)/4)" as expression, but when I tried to execute , an error rose!
A scope problem

did I wrong the place to write the expression?

Thanks in advance

Wednesday, March 28, 2012

Padding fields with zeros.

I am trying to create a field in SQL query builder that takes the input number 12345 and formats it 0000012345. In MSAccess there is a great Format() function which allowed this to be done easily, but I cant find an equivalent in SQLServer. Can anyone provide me with a new function and possibly a sample? Thanks in Advance,

Michael.

try this

SELECT cast(replace(str(12345 ,10),' ','0') AS char(10))

OR write Stored Procedure as you need ( i think)

CREATE FUNCTION fnPadLeft

( @.PadChar char(1), @.PadToLen int, @.BaseString varchar(100) )

RETURNS varchar(1000)

AS

BEGIN

DECLARE @.Padded varchar(1000)

DECLARE @.BaseLen int

SET @.BaseLen = LEN(@.BaseString)

IF @.BaseLen >= @.PadToLen

BEGIN

SET @.Padded = @.BaseString

END

ELSE

BEGIN

SET @.Padded = REPLICATE(@.PadChar, @.PadToLen - @.BaseLen) + @.BaseString

END

RETURN @.Padded

END

Now try this

SELECT dbo.fnPadLeft('0', 10, 12345) ==> 0000012345

Parameters:

First = Padding character

Second = Total Length

Third = Your Column

Best of Luck

Regards,

Thanks.

Gurpreet S .Gill

|||

You can also try this

select Replicate('0',10-Len(Column1))+ Convert(Varchar,Column1) from Table1

I am assuming Column1 in the table is INT. If it is varchar, no need to for conversion.

|||

SELECT RIGHT('0000000000' + CONVERT(VARCHAR(10),col1) , 10) FROM table1

|||

Thanks all! I will give it a shot...

Michael

Pad Trailing Spaces in a Report Expression

I am trying to pad a fixed number of trailing spaces into a report expression, as follows:

Data:

CUSTOMER_NAME
-
Michael
Peter
John

Result (e.g. with 10 spaces padded, assuming all names are below 10 characters long):

"Michael "
"Peter "
"John "

Is there an easy way to achieve this ?

Thanks.

Kenny

If you want a 10 character string, right padded with spaces, you could do this:

=Fields!datafield.Value & right(" ", 10 - len(Fields!datafield.Value))

(10 spaces in quotes)

HTH

BobP

Monday, March 26, 2012

Packages

Hello all,
Apologies if this is in the wrong group.
I'm only just starting to use SQL Server 2000 after using Oracle for a
number of years. Can you tell me if Server 2000 has the concept of packages,
where I can package all associated stored procs togther. For example, all
stored procs to do with the Employee table?
Thanks all,
JonJon
No, It does not exist in SQL Server in this concept but it does exist in
concept of DTS packages to copy/modify data
"Jon" <Jon@.discussions.microsoft.com> wrote in message
news:BABA5A45-72F5-45D2-8318-7396FB095C0B@.microsoft.com...
> Hello all,
> Apologies if this is in the wrong group.
> I'm only just starting to use SQL Server 2000 after using Oracle for a
> number of years. Can you tell me if Server 2000 has the concept of
packages,
> where I can package all associated stored procs togther. For example, all
> stored procs to do with the Employee table?
> Thanks all,
> Jon|||Unfortunately not (*). A database has a number of stored procedures. Period... :-)
But nothing stop you from having one procedure calling another or having a naming convention with
which you easier see some "grouping".
There actually is one way of grouping stored procedures, like below. Very rarely used, and my guess
is that this is on target list to be removed in the future.
CREATE PROC p;1 AS SELECT 1
CREATE PROC p;2 AS SELECT 2
EXEC p;1
EXEC p;2
DROP PROCEDURE p;1 --No can do
DROP PROCEDURE p --Drops all!!!
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jon" <Jon@.discussions.microsoft.com> wrote in message
news:BABA5A45-72F5-45D2-8318-7396FB095C0B@.microsoft.com...
> Hello all,
> Apologies if this is in the wrong group.
> I'm only just starting to use SQL Server 2000 after using Oracle for a
> number of years. Can you tell me if Server 2000 has the concept of packages,
> where I can package all associated stored procs togther. For example, all
> stored procs to do with the Employee table?
> Thanks all,
> Jon|||Thanks guys.
"Jon" wrote:
> Hello all,
> Apologies if this is in the wrong group.
> I'm only just starting to use SQL Server 2000 after using Oracle for a
> number of years. Can you tell me if Server 2000 has the concept of packages,
> where I can package all associated stored procs togther. For example, all
> stored procs to do with the Employee table?
> Thanks all,
> Jon

Wednesday, March 21, 2012

Package fails when ran as a scheduled job

I have a large number of SSIS packages, which I have developed over the last few months.

Having written and tested them locally, running in VS05 etc - I have moved them to a server, stored in the MSDB database.

I am having real troubles with packages that move tables from one database to another.

I am working on a migration project, so I have several packages that move tables from the source database, into my staging database.

One package which will not run at all, basically just moves 15 tables from database A on my server to database B.

The package is essentially a few SQL tasks to create tables, then a data flow.

The data flow contains the table movements as an OLE DB source to an OLE DB destination. No intermediate processing.

In an attempt to get some meaningful logs of the reasons for failre I ran the package from the commandline with the output piped to a text file. That text file contained the following error:

Error: 2006-11-20 11:48:47.78
Code: 0xC0202009
Source: Data Flow Task Source - tblParking [1641]
Description: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Protocol error in TDS stream".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
End Error
Error: 2006-11-20 11:48:47.78
Code: 0xC0047038
Source: Data Flow Task DTS.Pipeline
Description: The PrimeOutput method on component "Source - tblParking" (1641) returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
End Error
Error: 2006-11-20 11:48:47.84
Code: 0xC0047021
Source: Data Flow Task DTS.Pipeline
Description: Thread "SourceThread1" has exited with error code 0xC0047038.
End Error

I've googled for most of the error messages there, and tried applying some of the things I found.

I've set the commit size on the OLE DB destination to 10k rows.

I've set the number of engine threads to 2.

The SQL Agent service is started by a domain user that has sufficient server and database roles to do what it needs - other packages run fine.

I'm really stumped here now - this package will run perfectly in visual studio, but fails when ran
as a scheduled task, and I'd really appreciate any advice or pointers

Matthew McNally wrote:

I have a large number of SSIS packages, which I have developed over the last few months.

Having written and tested them locally, running in VS05 etc - I have moved them to a server, stored in the MSDB database.

I am having real troubles with packages that move tables from one database to another.

I am working on a migration project, so I have several packages that move tables from the source database, into my staging database.

One package which will not run at all, basically just moves 15 tables from database A on my server to database B.

The package is essentially a few SQL tasks to create tables, then a data flow.

The data flow contains the table movements as an OLE DB source to an OLE DB destination. No intermediate processing.

In an attempt to get some meaningful logs of the reasons for failre I ran the package from the commandline with the output piped to a text file. That text file contained the following error:

Error: 2006-11-20 11:48:47.78
Code: 0xC0202009
Source: Data Flow Task Source - tblParking [1641]
Description: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Protocol error in TDS stream".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
End Error
Error: 2006-11-20 11:48:47.78
Code: 0xC0047038
Source: Data Flow Task DTS.Pipeline
Description: The PrimeOutput method on component "Source - tblParking" (1641) returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
End Error
Error: 2006-11-20 11:48:47.84
Code: 0xC0047021
Source: Data Flow Task DTS.Pipeline
Description: Thread "SourceThread1" has exited with error code 0xC0047038.
End Error

I've googled for most of the error messages there, and tried applying some of the things I found.

I've set the commit size on the OLE DB destination to 10k rows.

I've set the number of engine threads to 2.

The SQL Agent service is started by a domain user that has sufficient server and database roles to do what it needs - other packages run fine.

I'm really stumped here now - this package will run perfectly in visual studio, but fails when ran
as a scheduled task, and I'd really appreciate any advice or pointers

Every time I have received this error:

"Communication link failure".

It has been due to network connectivity isuues during the execution of my package; nothing to do with the package itself...not sure if that is always the case.

|||I dont think its a network problem Rafael

Firstly, as there should be no network traffic, as the source and target database are on the same server.

Secondly, the package will consistently fail as a scheduled task. I could run it now manually - and it would be fine. Schedule it to run 2 minutes later - and it will fail.

Actually - I only assume there is no network traffic. The server is called Llama, and my package has two data-sources, both of which are mapped to databases on Llama.

Surely this does not mean that these packages are sending data across the network to talk to the server they reside on?|||

Verify your boot.ini file on that server and make sure that there is no memory limit like using /3GB flag. That will reduce available memory to outside applications. We faced similar issues on "Communication link failure". After removing /3gb limit flag it was running fine.

Best of luck.

Veera Maganti

|||Thanks for your response Veera.

the boot.ini on this server does not have the /3gb switch

The whole boot.ini is:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Windows Server 2003, Standard" /fastdetect /NoExecute=OptOut
|||

Well there's your problem right there. Your server is called "Llama". if you upgrade to the "Cheetah" it will run just fine.

just joking... did you try entering a password into the SSIS to encryptsensativedatawithpassword? then schedule it and enter the password in there?

|||

Hi Matthew,

I have the same error, I want to know if you can solve this problem.

Thank you for your help.

Antonio

Package fails when ran as a scheduled job

I have a large number of SSIS packages, which I have developed over the last few months.

Having written and tested them locally, running in VS05 etc - I have moved them to a server, stored in the MSDB database.

I am having real troubles with packages that move tables from one database to another.

I am working on a migration project, so I have several packages that move tables from the source database, into my staging database.

One package which will not run at all, basically just moves 15 tables from database A on my server to database B.

The package is essentially a few SQL tasks to create tables, then a data flow.

The data flow contains the table movements as an OLE DB source to an OLE DB destination. No intermediate processing.

In an attempt to get some meaningful logs of the reasons for failre I ran the package from the commandline with the output piped to a text file. That text file contained the following error:

Error: 2006-11-20 11:48:47.78
Code: 0xC0202009
Source: Data Flow Task Source - tblParking [1641]
Description: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Protocol error in TDS stream".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
End Error
Error: 2006-11-20 11:48:47.78
Code: 0xC0047038
Source: Data Flow Task DTS.Pipeline
Description: The PrimeOutput method on component "Source - tblParking" (1641) returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
End Error
Error: 2006-11-20 11:48:47.84
Code: 0xC0047021
Source: Data Flow Task DTS.Pipeline
Description: Thread "SourceThread1" has exited with error code 0xC0047038.
End Error

I've googled for most of the error messages there, and tried applying some of the things I found.

I've set the commit size on the OLE DB destination to 10k rows.

I've set the number of engine threads to 2.

The SQL Agent service is started by a domain user that has sufficient server and database roles to do what it needs - other packages run fine.

I'm really stumped here now - this package will run perfectly in visual studio, but fails when ran
as a scheduled task, and I'd really appreciate any advice or pointers

Matthew McNally wrote:

I have a large number of SSIS packages, which I have developed over the last few months.

Having written and tested them locally, running in VS05 etc - I have moved them to a server, stored in the MSDB database.

I am having real troubles with packages that move tables from one database to another.

I am working on a migration project, so I have several packages that move tables from the source database, into my staging database.

One package which will not run at all, basically just moves 15 tables from database A on my server to database B.

The package is essentially a few SQL tasks to create tables, then a data flow.

The data flow contains the table movements as an OLE DB source to an OLE DB destination. No intermediate processing.

In an attempt to get some meaningful logs of the reasons for failre I ran the package from the commandline with the output piped to a text file. That text file contained the following error:

Error: 2006-11-20 11:48:47.78
Code: 0xC0202009
Source: Data Flow Task Source - tblParking [1641]
Description: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Protocol error in TDS stream".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
End Error
Error: 2006-11-20 11:48:47.78
Code: 0xC0047038
Source: Data Flow Task DTS.Pipeline
Description: The PrimeOutput method on component "Source - tblParking" (1641) returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
End Error
Error: 2006-11-20 11:48:47.84
Code: 0xC0047021
Source: Data Flow Task DTS.Pipeline
Description: Thread "SourceThread1" has exited with error code 0xC0047038.
End Error

I've googled for most of the error messages there, and tried applying some of the things I found.

I've set the commit size on the OLE DB destination to 10k rows.

I've set the number of engine threads to 2.

The SQL Agent service is started by a domain user that has sufficient server and database roles to do what it needs - other packages run fine.

I'm really stumped here now - this package will run perfectly in visual studio, but fails when ran
as a scheduled task, and I'd really appreciate any advice or pointers

Every time I have received this error:

"Communication link failure".

It has been due to network connectivity isuues during the execution of my package; nothing to do with the package itself...not sure if that is always the case.

|||I dont think its a network problem Rafael

Firstly, as there should be no network traffic, as the source and target database are on the same server.

Secondly, the package will consistently fail as a scheduled task. I could run it now manually - and it would be fine. Schedule it to run 2 minutes later - and it will fail.

Actually - I only assume there is no network traffic. The server is called Llama, and my package has two data-sources, both of which are mapped to databases on Llama.

Surely this does not mean that these packages are sending data across the network to talk to the server they reside on?|||

Verify your boot.ini file on that server and make sure that there is no memory limit like using /3GB flag. That will reduce available memory to outside applications. We faced similar issues on "Communication link failure". After removing /3gb limit flag it was running fine.

Best of luck.

Veera Maganti

|||Thanks for your response Veera.

the boot.ini on this server does not have the /3gb switch

The whole boot.ini is:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Windows Server 2003, Standard" /fastdetect /NoExecute=OptOut
|||

Well there's your problem right there. Your server is called "Llama". if you upgrade to the "Cheetah" it will run just fine.

just joking... did you try entering a password into the SSIS to encryptsensativedatawithpassword? then schedule it and enter the password in there?

|||

Hi Matthew,

I have the same error, I want to know if you can solve this problem.

Thank you for your help.

Antonio

Package fails when ran as a scheduled job

I have a large number of SSIS packages, which I have developed over the last few months.

Having written and tested them locally, running in VS05 etc - I have moved them to a server, stored in the MSDB database.

I am having real troubles with packages that move tables from one database to another.

I am working on a migration project, so I have several packages that move tables from the source database, into my staging database.

One package which will not run at all, basically just moves 15 tables from database A on my server to database B.

The package is essentially a few SQL tasks to create tables, then a data flow.

The data flow contains the table movements as an OLE DB source to an OLE DB destination. No intermediate processing.

In an attempt to get some meaningful logs of the reasons for failre I ran the package from the commandline with the output piped to a text file. That text file contained the following error:

Error: 2006-11-20 11:48:47.78
Code: 0xC0202009
Source: Data Flow Task Source - tblParking [1641]
Description: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Protocol error in TDS stream".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
End Error
Error: 2006-11-20 11:48:47.78
Code: 0xC0047038
Source: Data Flow Task DTS.Pipeline
Description: The PrimeOutput method on component "Source - tblParking" (1641) returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
End Error
Error: 2006-11-20 11:48:47.84
Code: 0xC0047021
Source: Data Flow Task DTS.Pipeline
Description: Thread "SourceThread1" has exited with error code 0xC0047038.
End Error

I've googled for most of the error messages there, and tried applying some of the things I found.

I've set the commit size on the OLE DB destination to 10k rows.

I've set the number of engine threads to 2.

The SQL Agent service is started by a domain user that has sufficient server and database roles to do what it needs - other packages run fine.

I'm really stumped here now - this package will run perfectly in visual studio, but fails when ran
as a scheduled task, and I'd really appreciate any advice or pointers

Matthew McNally wrote:

I have a large number of SSIS packages, which I have developed over the last few months.

Having written and tested them locally, running in VS05 etc - I have moved them to a server, stored in the MSDB database.

I am having real troubles with packages that move tables from one database to another.

I am working on a migration project, so I have several packages that move tables from the source database, into my staging database.

One package which will not run at all, basically just moves 15 tables from database A on my server to database B.

The package is essentially a few SQL tasks to create tables, then a data flow.

The data flow contains the table movements as an OLE DB source to an OLE DB destination. No intermediate processing.

In an attempt to get some meaningful logs of the reasons for failre I ran the package from the commandline with the output piped to a text file. That text file contained the following error:

Error: 2006-11-20 11:48:47.78
Code: 0xC0202009
Source: Data Flow Task Source - tblParking [1641]
Description: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Protocol error in TDS stream".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Communication link failure".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Shared Memory Provider: No process is on the other end of the pipe.
".
End Error
Error: 2006-11-20 11:48:47.78
Code: 0xC0047038
Source: Data Flow Task DTS.Pipeline
Description: The PrimeOutput method on component "Source - tblParking" (1641) returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
End Error
Error: 2006-11-20 11:48:47.84
Code: 0xC0047021
Source: Data Flow Task DTS.Pipeline
Description: Thread "SourceThread1" has exited with error code 0xC0047038.
End Error

I've googled for most of the error messages there, and tried applying some of the things I found.

I've set the commit size on the OLE DB destination to 10k rows.

I've set the number of engine threads to 2.

The SQL Agent service is started by a domain user that has sufficient server and database roles to do what it needs - other packages run fine.

I'm really stumped here now - this package will run perfectly in visual studio, but fails when ran
as a scheduled task, and I'd really appreciate any advice or pointers

Every time I have received this error:

"Communication link failure".

It has been due to network connectivity isuues during the execution of my package; nothing to do with the package itself...not sure if that is always the case.

|||I dont think its a network problem Rafael

Firstly, as there should be no network traffic, as the source and target database are on the same server.

Secondly, the package will consistently fail as a scheduled task. I could run it now manually - and it would be fine. Schedule it to run 2 minutes later - and it will fail.

Actually - I only assume there is no network traffic. The server is called Llama, and my package has two data-sources, both of which are mapped to databases on Llama.

Surely this does not mean that these packages are sending data across the network to talk to the server they reside on?
|||

Verify your boot.ini file on that server and make sure that there is no memory limit like using /3GB flag. That will reduce available memory to outside applications. We faced similar issues on "Communication link failure". After removing /3gb limit flag it was running fine.

Best of luck.

Veera Maganti

|||Thanks for your response Veera.

the boot.ini on this server does not have the /3gb switch

The whole boot.ini is:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Windows Server 2003, Standard" /fastdetect /NoExecute=OptOut

|||

Well there's your problem right there. Your server is called "Llama". if you upgrade to the "Cheetah" it will run just fine.

just joking... did you try entering a password into the SSIS to encryptsensativedatawithpassword? then schedule it and enter the password in there?

|||

Hi Matthew,

I have the same error, I want to know if you can solve this problem.

Thank you for your help.

Antonio

Tuesday, March 20, 2012

Package Configurations - Using One config file for Multiple Packages

Hi All,

I am working on a project currently where we have many SSIS packages and we want to minimize the number of config files to be used. What I was thinking was using one master config file which will have Server/Database info which will be used by all the packages. Now the thing is there are multiple packages which are being executed from within a master package and I was wondering if this will be an issue. Is there anything else that I will have to keep in mind? Any help is appreciated.

Thanks

If my memory serves correctly then you will get lots of warnings about references in your config file to properties that don't exist in your package. But it should still execute OK.

-Jamie

|||Thanks Jamie

Friday, March 9, 2012

P

Let's imagine I have a list of countries and the number of people for each of them. I would like to create a matrix representing the bigger countries which contain 50% of the mondial population.

The "top N" and "top %" function won't do the trick. If I had to create this matrix manually I would just order the country list by the number of people, and add each line in the matrix until the total amount of people represent 50% of the mondial population.

I just can't find a way to do that with Reporting Services 2005. Does anyone has an idea ?

Thanks

Well, I don't know if that's posible with Reporting Services. I would use a cursor and a temporary table.

Wednesday, March 7, 2012

Own forum - number of posts and stars/ranges - how to make it ??

So I have simple forum. At main page I have gridView which display topics. When I go to topic #5 (for example) I use repeater to display posts and authors. Here is a code:

SELECT aspnet_Users.UserName, forum_posts.post_id,
forum_posts.post_content, forum_posts.topic_id, forum_posts.post_date
FROM aspnet_Users
INNER JOIN forum_posts
ON aspnet_Users.uID = forum_posts.user_id
WHERE (forum_posts.topic_id = @.topic_id)

Now I have a problem - how can I display with each user his number of posts - eventually how can I display for example if he has 25 posts - one star, 50 posts - two stars, or maybe display "Starter" range, etc. How to make this, cause I don't have any idea.

This is complex stuff but the creator of the London SQL Server user group have very nice existing code which also include a function so go to the link below and in the left search pane write in Full text index and you will see his presentation PPT slides you will get all you need in it. Hope this helps.

http://www.sqlserverfaq.com

|||

Thx for reply, but I don't know what I have to look for:

in the left search pane write in Full text index and you will see his presentation PPT

My english is not good, so forgive me, what I have to look for ? :)

|||

If what you are looking for is like what is in this thread then send me an emailCaddre@.hotmail.com and I will send you the whole presentation. Hope this helps.

http://forums.asp.net/thread/908572.aspx

|||

I sent an email to you :-)

You see - on the left from the post message here you have your name, photo, date of join and number of posts. I want this number and also make some stars/ranks depends on the number of posts. How to do it ? :-)

Little explaination about what I have:

I have Asp.net tables (by Membership).

I have also table "forum_topics":

topic_id; topic_title; user_id; topic_catId; topic_date

And table "forum_posts":

post_id; topic_id; user_id; post_content; post_date

I use stored procedures to add topic/post.


I use repeater to display posts from topic, to display topics I use gridView.

I hope you will help me :-)

|||I have sent you the file you need a function to get that info from a T-SQL tree code and it also include FTP address to get the .NET code if you need it. The person in that thread went through a lot but the file helped the person because it includes your create table statement.|||

FTP doesn't work :-(

But as you said I have to look for function in T-SQL to take out this numbers, etc, yes ?

|||All the T-SQL code is in the PPT slides and you can send Tony an email I have sent him an email 6years ago. You have to take time and create your version because the person in that thread got all they needed.|||

Ok, I've made to display a UserName with posts count :

SELECT aspnet_Users.UserName, COUNT(forum_posts.post_id) AS IlePost
FROM aspnet_Users INNER JOIN
forum_posts ON aspnet_Users.uID = forum_posts.user_id
GROUP BY aspnet_Users.UserName

Now simply I have to make something to calculating stars depend on posts.

But I think that I could do this by the code-behind in asp - simply comparing:

x - number of posts:

0<x<20 - display one star
21<x<50 - display two stars
etc.

Do you think that this is good way to do that what I want ?

|||

I have told you it is not that simple and you don't need a Group By, here is the baseline code, now go do some copying of the code in the file I sent you.

CREATE TABLE mb_mesage(
id int IDENTITY (1, 1) NOT NULL
parent_mb_message_id int NULL

entry_date datetime NOT NULL DEFAULT (GETDATE()),
parent_entry_date datetime NOT NULL DEFAULT (GETDATE()),
flattened_tree Varchar (900) NOT NULL
DEFAULT(CONVERT(varchar(20), GETDATE(),121) + REPLICATE('0',50)),
message_depth tinyint NOT NULL DEFAULT (0),
last_posting AS (dbo.fn_message_cal_last_posting(id)),
top_parent_mb_message_id
AS (LEFT(flattened_tree(CHARINDEX( ',', flattened_tree)-1)))
)

CREATE TABLE mb_message_detail(
mb_message_id int NOT NULL,
author_id int NOT NULL,
title varchar (500) NOT NULL,
body text NOT NULL,
timestamp timestamp NOT NULL,
)


NORMAl QUERY RECENT POSTING

CREATE FUNCTION fn_message_calc_last_posting (mb_message_id int)
RETURNS datetime
AS
BEGIN
DECLARE @.dt datetime=
(SELECT MAX (entry_date)
FROM mb_message
WHERE flatened_tree LIKE CAST(@. mb_message_id AS varchar (20)) + ',%'
)
RETURN @.dt
END

----
SELECT*
FROM mb_message
WHERE parent_mb_message_id IS NULL
ORDER BY Last_post DESC

To get all children posting simply use LIKE using the root message ID as the source

DECLARE @.root_mb_message_id int
SET @.root_mb_message_id =100895

SELECT spacers =REPLICATE ('+-' message_depth ),
mb_flattened_tree,
entry_date = mb_entry_date,
reads = CAST (mb_message_reads AS varchar (20)),
mb_parent_mb_message_id,
mb_message_id = mb_id,
mb_message_depth,
FROM mb_message mb,
INNER JOIN mb_message_detail md On md mb_message_id = mb_id
WHERE flattened_tree LIKE CAST (@. root_mb_message_id AS vachar (20) ) + ',%'
ORDER BY flattened_tree

Saturday, February 25, 2012

overload function call

Hi,

I want to write one function like that

dbo.function( number , 1 , 2 ) ,

but I would like to overload, and send char or number

dbo.function( number, 'abx' , ' xpto' ).

I would like to keep the same name, Can I do this? or Do I need to write to differents functions

thanks,

Hi Alessandro,

Yes, this can be done. You would use the sql_variant datatype as such:

create function fntest (@.one sql_variant, @.two sql_variant)
returns int
as
begin
declare @.ret int

set @.ret = 0

if (select SQL_VARIANT_PROPERTY(@.one,'BaseType')) = 'int'
begin
set @.ret = 99
end

return (@.ret)
end;

The SQL_VARIANT_PROPERTY function will return the base data type, so you can therefore test for not only int, but varchar etc.

Cheers,

Rob

|||

Hi Rob,

Thank you.... Can I do this for return parameter?

Thanks

|||

Hi Alessandro,

Sure can, in the above example, you'd simply change the returning datatype:

create function fntest2 (@.one sql_variant, @.two sql_variant)
returns sql_variant
as
begin

Cheers,

Rob

|||

Hi Rob,

Yes it is true, but I can send or return float values sql_variant doesn't work for this :(

In fact I want to do this.

funtion ( number (always number) , char/number(param1) , char/number(param2) )

if number = 1

return param1

else param 2

similar to oracle decode, but I dont know how to do, do you have any ideia? Maybe clr function but I think overload function via c# doesn't work as well

thanks,

|||

Hi Alessandro,

I think I understand what you want, and the below will let you do this:

create function fntest2 (@.one sql_variant, @.two sql_variant)
returns sql_variant
as
begin
declare @.ret sql_variant

set @.ret = 0

if (select SQL_VARIANT_PROPERTY(@.one,'BaseType')) = 'int'
begin
set @.ret = @.one
end
else
begin
set @.ret = @.two
end

return (@.ret)
end;

Is that what you were after, or did you mean something else?

Cheers,
Rob

|||

Hi Rob,

Yes, but when you call with float from Select clauses like

select fntest( 1 , value1(float) , value2 (float) )

doesn't work I need to convert, have you tried?

Thanks

|||

Hi Alessandro,

What about the below:


create function fntest2 (@.one int, @.two sql_variant, @.three sql_variant)
returns sql_variant
as
begin
declare @.ret sql_variant

set @.ret = 0

if (select SQL_VARIANT_PROPERTY(@.two,'BaseType')) = 'int'
begin
set @.ret = 'it is an int'
end
else if (select SQL_VARIANT_PROPERTY(@.two,'BaseType')) = 'float'
begin
set @.ret = 'it is a float'
end
--more if else statements here...

return (@.ret)
end;

declare @.f float
set @.f = 123.9982

select tempdb.dbo.fntest2( 1 , @.f , 'another param here' )

This returns the character line "it is a float" as the param @.f is explicity defined as float. If you execute the below line:

select tempdb.dbo.fntest2( 1 , 23.55 , 'another param here' )

0 will be returned as 23.55 is interpreted as type numeric

Cheers,

Rob

|||

Hi Rob,

Woks well, thanks, however when I try doing this

select tempdb.dbo.fntest2( 1 , 23.55 , 'another param here' ) - tempdb.dbo.fntest2( 1 , 23.55 , 'another param here' )

I receive this msg

Operand data type sql_variant is invalid for subtract operator.

thanks,

|||

Hi Alessandro,

Yes, that's correct - you cannot perform mathematical operations on the sql_variant datatype. This makes sense as sql has no idea what type it is: it may be binary, or one may be char, and the other numeric or both may be char, in which case you would receive concatenation of the two char values: probably not what you intended...

You'll need to perform an explicit cast as such:

declare @.a sql_variant,
@.b sql_variant

set @.a = 2;
set @.b = 1;

begin try
select (cast(@.a as int) + cast(@.b as int)) as 'sum'
end try
begin catch
print ERROR_MESSAGE()
end catch

You'll need to include the explicit cast in a try block in order to catch any conversion errors (for example, if @.a is a char value, not int).

Cheers,

Rob

overload function call

Hi,

I want to write one function like that

dbo.function( number , 1 , 2 ) ,

but I would like to overload, and send char or number

dbo.function( number, 'abx' , ' xpto' ).

I would like to keep the same name, Can I do this? or Do I need to write to differents functions

thanks,

Hi Alessandro,

Yes, this can be done. You would use the sql_variant datatype as such:

create function fntest (@.one sql_variant, @.two sql_variant)
returns int
as
begin
declare @.ret int

set @.ret = 0

if (select SQL_VARIANT_PROPERTY(@.one,'BaseType')) = 'int'
begin
set @.ret = 99
end

return (@.ret)
end;

The SQL_VARIANT_PROPERTY function will return the base data type, so you can therefore test for not only int, but varchar etc.

Cheers,

Rob

|||

Hi Rob,

Thank you.... Can I do this for return parameter?

Thanks

|||

Hi Alessandro,

Sure can, in the above example, you'd simply change the returning datatype:

create function fntest2 (@.one sql_variant, @.two sql_variant)
returns sql_variant
as
begin

Cheers,

Rob

|||

Hi Rob,

Yes it is true, but I can send or return float values sql_variant doesn't work for this :(

In fact I want to do this.

funtion ( number (always number) , char/number(param1) , char/number(param2) )

if number = 1

return param1

else param 2

similar to oracle decode, but I dont know how to do, do you have any ideia? Maybe clr function but I think overload function via c# doesn't work as well

thanks,

|||

Hi Alessandro,

I think I understand what you want, and the below will let you do this:

create function fntest2 (@.one sql_variant, @.two sql_variant)
returns sql_variant
as
begin
declare @.ret sql_variant

set @.ret = 0

if (select SQL_VARIANT_PROPERTY(@.one,'BaseType')) = 'int'
begin
set @.ret = @.one
end
else
begin
set @.ret = @.two
end

return (@.ret)
end;

Is that what you were after, or did you mean something else?

Cheers,
Rob

|||

Hi Rob,

Yes, but when you call with float from Select clauses like

select fntest( 1 , value1(float) , value2 (float) )

doesn't work I need to convert, have you tried?

Thanks

|||

Hi Alessandro,

What about the below:


create function fntest2 (@.one int, @.two sql_variant, @.three sql_variant)
returns sql_variant
as
begin
declare @.ret sql_variant

set @.ret = 0

if (select SQL_VARIANT_PROPERTY(@.two,'BaseType')) = 'int'
begin
set @.ret = 'it is an int'
end
else if (select SQL_VARIANT_PROPERTY(@.two,'BaseType')) = 'float'
begin
set @.ret = 'it is a float'
end
--more if else statements here...

return (@.ret)
end;

declare @.f float
set @.f = 123.9982

select tempdb.dbo.fntest2( 1 , @.f , 'another param here' )

This returns the character line "it is a float" as the param @.f is explicity defined as float. If you execute the below line:

select tempdb.dbo.fntest2( 1 , 23.55 , 'another param here' )

0 will be returned as 23.55 is interpreted as type numeric

Cheers,

Rob

|||

Hi Rob,

Woks well, thanks, however when I try doing this

select tempdb.dbo.fntest2( 1 , 23.55 , 'another param here' ) - tempdb.dbo.fntest2( 1 , 23.55 , 'another param here' )

I receive this msg

Operand data type sql_variant is invalid for subtract operator.

thanks,

|||

Hi Alessandro,

Yes, that's correct - you cannot perform mathematical operations on the sql_variant datatype. This makes sense as sql has no idea what type it is: it may be binary, or one may be char, and the other numeric or both may be char, in which case you would receive concatenation of the two char values: probably not what you intended...

You'll need to perform an explicit cast as such:

declare @.a sql_variant,
@.b sql_variant

set @.a = 2;
set @.b = 1;

begin try
select (cast(@.a as int) + cast(@.b as int)) as 'sum'
end try
begin catch
print ERROR_MESSAGE()
end catch

You'll need to include the explicit cast in a try block in order to catch any conversion errors (for example, if @.a is a char value, not int).

Cheers,

Rob

Monday, February 20, 2012

Overhead of Multiple SQL Calls

Hey folks,
I've got a client server C# Windows Form app that communicates with a SQL
Server database backend. The number of users is less than 50.
I'm wondering what the difference in overhead is when say:
a) A Stored Procedure is called ten times, returning 1 record each time
VS.
b) The same Stored Procedure is called once returning 10 records
Due to connection pooling I would think the overhead is somewhat negligible,
especially when there's less than 50 users. I know option 'b' would be the
preffered method when it comes to database communication, but is there
really a BIG difference between the two when dealing with this few users?
Thanks!
(also posted on windows.forms newsgroup on Feb 25 with no response)Hi John,
I would think the network traffic would be significantly greater when
submiting 10 calls to get 1 record each as opposed to 1 call to get 10
records. That's automatically 10X the client-to-server network traffic.
Constantly opening and closing connections, as well as maintaining
connections that aren't in use, can use up a lot of resources on SQL Server
also. Now whether this should cause problems with a small number of users
is another story... It probably depends on how they're using the server...
Are they running automated reports that are requesting records one at a time
and might include thousands of separate requests? Or maybe they're just
accessing 30 records/hour on average each?
Connection pooling helps, but it can't compensate completely for a design
flaw.
Are you using C#.NET? If so, you might look into ADO.NET. ADO.NET is
designed to handle a lot of the management issues for you.
Thanks,
Mike C.
"John Smith" <js@.no.com> wrote in message
news:OHFsJQqHFHA.560@.TK2MSFTNGP12.phx.gbl...
> Hey folks,
> I've got a client server C# Windows Form app that communicates with a SQL
> Server database backend. The number of users is less than 50.
> I'm wondering what the difference in overhead is when say:
> a) A Stored Procedure is called ten times, returning 1 record each time
> VS.
> b) The same Stored Procedure is called once returning 10 records
> Due to connection pooling I would think the overhead is somewhat
> negligible,
> especially when there's less than 50 users. I know option 'b' would be
> the
> preffered method when it comes to database communication, but is there
> really a BIG difference between the two when dealing with this few users?
> Thanks!
> (also posted on windows.forms newsgroup on Feb 25 with no response)
>|||You have that many today but what about tomorrow? Seriously you should
always keep scalability in mind when designing the app and the schema. In
your example you are incurring about 10 times the overhead on not only the
server but the network and the client. There certainly may be times when it
might make sense to do it the A way but if you can do it the B way then you
should.
--
Andrew J. Kelly SQL MVP
"John Smith" <js@.no.com> wrote in message
news:OHFsJQqHFHA.560@.TK2MSFTNGP12.phx.gbl...
> Hey folks,
> I've got a client server C# Windows Form app that communicates with a SQL
> Server database backend. The number of users is less than 50.
> I'm wondering what the difference in overhead is when say:
> a) A Stored Procedure is called ten times, returning 1 record each time
> VS.
> b) The same Stored Procedure is called once returning 10 records
> Due to connection pooling I would think the overhead is somewhat
> negligible,
> especially when there's less than 50 users. I know option 'b' would be
> the
> preffered method when it comes to database communication, but is there
> really a BIG difference between the two when dealing with this few users?
> Thanks!
> (also posted on windows.forms newsgroup on Feb 25 with no response)
>

Overhead of Multiple SQL Calls

Hey folks,
I've got a client server C# Windows Form app that communicates with a SQL
Server database backend. The number of users is less than 50.
I'm wondering what the difference in overhead is when say:
a) A Stored Procedure is called ten times, returning 1 record each time
VS.
b) The same Stored Procedure is called once returning 10 records
Due to connection pooling I would think the overhead is somewhat negligible,
especially when there's less than 50 users. I know option 'b' would be the
preffered method when it comes to database communication, but is there
really a BIG difference between the two when dealing with this few users?
Thanks!
(also posted on windows.forms newsgroup on Feb 25 with no response)Hi John,
I would think the network traffic would be significantly greater when
submiting 10 calls to get 1 record each as opposed to 1 call to get 10
records. That's automatically 10X the client-to-server network traffic.
Constantly opening and closing connections, as well as maintaining
connections that aren't in use, can use up a lot of resources on SQL Server
also. Now whether this should cause problems with a small number of users
is another story... It probably depends on how they're using the server...
Are they running automated reports that are requesting records one at a time
and might include thousands of separate requests? Or maybe they're just
accessing 30 records/hour on average each?
Connection pooling helps, but it can't compensate completely for a design
flaw.
Are you using C#.NET? If so, you might look into ADO.NET. ADO.NET is
designed to handle a lot of the management issues for you.
Thanks,
Mike C.
"John Smith" <js@.no.com> wrote in message
news:OHFsJQqHFHA.560@.TK2MSFTNGP12.phx.gbl...
> Hey folks,
> I've got a client server C# Windows Form app that communicates with a SQL
> Server database backend. The number of users is less than 50.
> I'm wondering what the difference in overhead is when say:
> a) A Stored Procedure is called ten times, returning 1 record each time
> VS.
> b) The same Stored Procedure is called once returning 10 records
> Due to connection pooling I would think the overhead is somewhat
> negligible,
> especially when there's less than 50 users. I know option 'b' would be
> the
> preffered method when it comes to database communication, but is there
> really a BIG difference between the two when dealing with this few users?
> Thanks!
> (also posted on windows.forms newsgroup on Feb 25 with no response)
>|||You have that many today but what about tomorrow? Seriously you should
always keep scalability in mind when designing the app and the schema. In
your example you are incurring about 10 times the overhead on not only the
server but the network and the client. There certainly may be times when it
might make sense to do it the A way but if you can do it the B way then you
should.
Andrew J. Kelly SQL MVP
"John Smith" <js@.no.com> wrote in message
news:OHFsJQqHFHA.560@.TK2MSFTNGP12.phx.gbl...
> Hey folks,
> I've got a client server C# Windows Form app that communicates with a SQL
> Server database backend. The number of users is less than 50.
> I'm wondering what the difference in overhead is when say:
> a) A Stored Procedure is called ten times, returning 1 record each time
> VS.
> b) The same Stored Procedure is called once returning 10 records
> Due to connection pooling I would think the overhead is somewhat
> negligible,
> especially when there's less than 50 users. I know option 'b' would be
> the
> preffered method when it comes to database communication, but is there
> really a BIG difference between the two when dealing with this few users?
> Thanks!
> (also posted on windows.forms newsgroup on Feb 25 with no response)
>

Overhead of Multiple SQL Calls

Hey folks,
I've got a client server C# Windows Form app that communicates with a SQL
Server database backend. The number of users is less than 50.
I'm wondering what the difference in overhead is when say:
a) A Stored Procedure is called ten times, returning 1 record each time
VS.
b) The same Stored Procedure is called once returning 10 records
Due to connection pooling I would think the overhead is somewhat negligible,
especially when there's less than 50 users. I know option 'b' would be the
preffered method when it comes to database communication, but is there
really a BIG difference between the two when dealing with this few users?
Thanks!
(also posted on windows.forms newsgroup on Feb 25 with no response)
Hi John,
I would think the network traffic would be significantly greater when
submiting 10 calls to get 1 record each as opposed to 1 call to get 10
records. That's automatically 10X the client-to-server network traffic.
Constantly opening and closing connections, as well as maintaining
connections that aren't in use, can use up a lot of resources on SQL Server
also. Now whether this should cause problems with a small number of users
is another story... It probably depends on how they're using the server...
Are they running automated reports that are requesting records one at a time
and might include thousands of separate requests? Or maybe they're just
accessing 30 records/hour on average each?
Connection pooling helps, but it can't compensate completely for a design
flaw.
Are you using C#.NET? If so, you might look into ADO.NET. ADO.NET is
designed to handle a lot of the management issues for you.
Thanks,
Mike C.
"John Smith" <js@.no.com> wrote in message
news:OHFsJQqHFHA.560@.TK2MSFTNGP12.phx.gbl...
> Hey folks,
> I've got a client server C# Windows Form app that communicates with a SQL
> Server database backend. The number of users is less than 50.
> I'm wondering what the difference in overhead is when say:
> a) A Stored Procedure is called ten times, returning 1 record each time
> VS.
> b) The same Stored Procedure is called once returning 10 records
> Due to connection pooling I would think the overhead is somewhat
> negligible,
> especially when there's less than 50 users. I know option 'b' would be
> the
> preffered method when it comes to database communication, but is there
> really a BIG difference between the two when dealing with this few users?
> Thanks!
> (also posted on windows.forms newsgroup on Feb 25 with no response)
>
|||You have that many today but what about tomorrow? Seriously you should
always keep scalability in mind when designing the app and the schema. In
your example you are incurring about 10 times the overhead on not only the
server but the network and the client. There certainly may be times when it
might make sense to do it the A way but if you can do it the B way then you
should.
Andrew J. Kelly SQL MVP
"John Smith" <js@.no.com> wrote in message
news:OHFsJQqHFHA.560@.TK2MSFTNGP12.phx.gbl...
> Hey folks,
> I've got a client server C# Windows Form app that communicates with a SQL
> Server database backend. The number of users is less than 50.
> I'm wondering what the difference in overhead is when say:
> a) A Stored Procedure is called ten times, returning 1 record each time
> VS.
> b) The same Stored Procedure is called once returning 10 records
> Due to connection pooling I would think the overhead is somewhat
> negligible,
> especially when there's less than 50 users. I know option 'b' would be
> the
> preffered method when it comes to database communication, but is there
> really a BIG difference between the two when dealing with this few users?
> Thanks!
> (also posted on windows.forms newsgroup on Feb 25 with no response)
>