Showing posts with label developing. Show all posts
Showing posts with label developing. Show all posts

Sunday, March 25, 2012

A weird error !

I was developing a data-driven website but I got this error

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

(I have Sql server 2005 also downloaded before)

Please help me cause any website that has data can not be executed even the quick start tutorial that ships with the ASP.NET 2.0

What should I do?

Hey,

If you go into the SQL Server Surface Area Configuration, then view the components, you can enable remote connections, which may solve the problem.

Sunday, February 19, 2012

A problem when opening PDF and EXCEL report

Hi, All
This is really weird. Here is the full story:
My company has a test site to test the application we are developing,
and the Reporting Server is on the same machine. Each developer has the
full application on their own machine so that they can test other parts
individually and check in to the test site later. But we are all using
the same webservice server (that test site machine) and the same report
database.
Now, when I run the report part locally, by locally, I mean I am
running the application in my own machine, but that application is
still loading the remote webservice to generate the report from the
remote database. The report generation is working correctly, I can open
the report and view.
But, if I run that part in the test site, it has a problem. It still
generates a report, but it will prompt a download window, and the
report extension name is always ASPX, (for pdf and excel file). If I
click Open, it will use Visual Studio to open it. If I click Save, and
change the extension name, it's a correct report.
More interesting, for PDF report, if the client machine has Adobe
Reader 7.0, it won't even prompt, instead, it would just show an empty
window, you know those empty windows, you can see the background
through that window, and if you move the window, the background will
follow. Yup, a kind of normal window. It only has that prompt window if
the client has Adobe Reader 6.0
Anyone has a clue how to solve this? Any help is appreciated, thank you
very much!
--
Best Regards!
SowenI saw this during the beta for 2005, but it cleared up once I went with the
released version of 2005. Has this machine ever had the beta on it?
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"sowen" <sowencheung@.gmail.com> wrote in message
news:1139930602.042085.322510@.f14g2000cwb.googlegroups.com...
> Hi, All
> This is really weird. Here is the full story:
> My company has a test site to test the application we are developing,
> and the Reporting Server is on the same machine. Each developer has the
> full application on their own machine so that they can test other parts
> individually and check in to the test site later. But we are all using
> the same webservice server (that test site machine) and the same report
> database.
> Now, when I run the report part locally, by locally, I mean I am
> running the application in my own machine, but that application is
> still loading the remote webservice to generate the report from the
> remote database. The report generation is working correctly, I can open
> the report and view.
> But, if I run that part in the test site, it has a problem. It still
> generates a report, but it will prompt a download window, and the
> report extension name is always ASPX, (for pdf and excel file). If I
> click Open, it will use Visual Studio to open it. If I click Save, and
> change the extension name, it's a correct report.
> More interesting, for PDF report, if the client machine has Adobe
> Reader 7.0, it won't even prompt, instead, it would just show an empty
> window, you know those empty windows, you can see the background
> through that window, and if you move the window, the background will
> follow. Yup, a kind of normal window. It only has that prompt window if
> the client has Adobe Reader 6.0
> Anyone has a clue how to solve this? Any help is appreciated, thank you
> very much!
> --
> Best Regards!
> Sowen
>|||hi, Bruce
thanks for your reply.
But we are still using VS 2003, SQL 2000 and .NET framework 1.1|||Ahh, OK. What Service Pack are you on?
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"sowen" <sowencheung@.gmail.com> wrote in message
news:1139933336.752696.258260@.g44g2000cwa.googlegroups.com...
> hi, Bruce
> thanks for your reply.
> But we are still using VS 2003, SQL 2000 and .NET framework 1.1
>|||for reporting service, SP2
for 2003 server, SP1,|||How are your viewing the report? In your own app? Report Manager? If your
own app are you using URL integration or web services? If in your own app,
does it work properly when you use Report Manager?
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"sowen" <sowencheung@.gmail.com> wrote in message
news:1139934523.097245.13230@.g44g2000cwa.googlegroups.com...
> for reporting service, SP2
> for 2003 server, SP1,
>|||via URL. sth like
http://localhost/mmis/ReportViewer/tabid/140/desktopdefault/+/Default.aspx,
(we are using DNN too.)
the code generating the report is correct.
It works properly if I run all application on my own machine's IIS.
It only has those problems if I run it on our test site (remotely)|||OK, I think what is happening is the Server 2003 internet security. Try
putting in the name of the machine instead of localhost and add the local
machine to the safezone.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"sowen" <sowencheung@.gmail.com> wrote in message
news:1139936364.847940.143500@.g44g2000cwa.googlegroups.com...
> via URL. sth like
> http://localhost/mmis/ReportViewer/tabid/140/desktopdefault/+/Default.aspx,
> (we are using DNN too.)
> the code generating the report is correct.
> It works properly if I run all application on my own machine's IIS.
> It only has those problems if I run it on our test site (remotely)
>|||do you mean adding our test site url in IE security trusted site?|||Here is what I suggest you do. Go to the test server. Open up IE and go to
report manager and make sure your reports and exports etc work as you they
should. Until you know it all works from report manager I wouldn't waste
much time wondering why it isn't working from your app. My guess is that you
will see some of the same issues there. Windows 2003 SP1 really protects
what web sites you can go to. You most likely need to add to trusted sites
in IE on the server.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"sowen" <sowencheung@.gmail.com> wrote in message
news:1139937391.453464.226010@.z14g2000cwz.googlegroups.com...
> do you mean adding our test site url in IE security trusted site?
>|||it works on our test site.
It is frustrated that the same code actually works on our another
remote test site, I just found out.
Is there any security configuration issue I should pay attention to?
It's strange that the same thing working on one machine but not another
machine.|||I mean it works on the test site report manager. I can see everything
running properly. But I have the same problem if I run the ASP.NET
program to create the PDF or EXCEL report, the prompt window asks me to
download a ASPX file.
But if I run the same code on another test machine, there is no such a
problem.
strange...

Monday, February 13, 2012

A lot Of Questions!!!

Good Morning..

i have started developing on DTS recently. and i have a few question about "How-To" issues.

Hope you guys can help

1) I noticed, whenever i want to "redirect row" whenever an error happen, i need to set my AccessMode to OpenRowSet... This mode as i noticed, cant be used when i am tranferring data into a sql table which has primary key set

e.g. Ms Access which has identity -> SQL table with PK set

Is there anyway, to capture the row error in my situation?

2) Another question is, in a data flow... can i have a source which has multiple output arrow.

Sorry for the inconvenince,Thank you in advance

I can hurry up and answer #2 for you. Place your output of the source into a multitask transformation. You'll get as many outputs as you want then.

Question though... Are you using the old DTS, or are you using SQL Server Integration Services?|||

Hi Phil thanks for the fast reply

I am using SSIS in SQL 2005....

For the first question...i have found a workaround...

In the destination table which has primary key and auto increment set to yes.. Before tranferring data into that particular table set the auto increment to "no"... With that we can "return row" as error output.....

By the way Phil...i cant c any multitask trnaformation in my data flow toolbox, all i c is a multicast.. are u referring to old DTS..

Thanks a lot guys ...

|||

I think Phill meant 'Multicast' transformation; it would privide n inputs out of a single output

Rafael Salas

|||

Rafael Salas wrote:

I think Phill meant 'Multicast' transformation; it would privide n inputs out of a single output

Rafael Salas

Yep, "multicast". Yesterday was not a good typing day for me!

Thursday, February 9, 2012

A fix for slow running SP, but why?

OK, so we have these three SPs that are causing no problem.
We start developing version 2 of the database, and though we've made
minimal changes to these routines, changing parameter one from GUID to
Int, same as we've done to hundreds of routines, suddenly these
routines run 1000x more slowly (both reads and CPU) when called from
the app. The same commands taken from a trace log and run in QA run
at full speed. OK, this happens and is hard to track down, but here's
the kicker. Turns out parameter two was called @.foo_date but was
declared as varchar(32), the better to append a time of day to it when
passed in, I guess. Well, we redeclared it as the datetime it should
have been, and voila, speed is back to normal.
OK, I understand why this might fix things, but I do not understand
why it was not also broken in the V1 database, and not broken even in
V2 when called from QA.
Voodoo is a good explanation, but I'm open to others.
Could it be a change in the clients? Well, we actually invoked these
SPs from a couple of different clients, some were unchanged (well,
except for the new datatype of parameter one!). But that still
wouldn't really explain why it was still OK when called from QA.
Thanks!
JoshWhen you called it from the app you most likely have a parameter object that
tells it what the datatype is. In this case a varchar. When you run it
adhoc in QA it most likely did an implicit conversion to datetime as it
passed it in to the sp. You should always declare the parameters to be
exactly what they need to be to correspond to the columns you are matching
them to in the WHERE clause. Other wise you leave it up to chance as to
what you get.
Andrew J. Kelly SQL MVP
"jxstern" <jxstern@.nowhere.xyz> wrote in message
news:ecbvg1h8rrq1e8mc9rm42k98a40g064ac2@.
4ax.com...
> OK, so we have these three SPs that are causing no problem.
> We start developing version 2 of the database, and though we've made
> minimal changes to these routines, changing parameter one from GUID to
> Int, same as we've done to hundreds of routines, suddenly these
> routines run 1000x more slowly (both reads and CPU) when called from
> the app. The same commands taken from a trace log and run in QA run
> at full speed. OK, this happens and is hard to track down, but here's
> the kicker. Turns out parameter two was called @.foo_date but was
> declared as varchar(32), the better to append a time of day to it when
> passed in, I guess. Well, we redeclared it as the datetime it should
> have been, and voila, speed is back to normal.
> OK, I understand why this might fix things, but I do not understand
> why it was not also broken in the V1 database, and not broken even in
> V2 when called from QA.
> Voodoo is a good explanation, but I'm open to others.
> Could it be a change in the clients? Well, we actually invoked these
> SPs from a couple of different clients, some were unchanged (well,
> except for the new datatype of parameter one!). But that still
> wouldn't really explain why it was still OK when called from QA.
> Thanks!
> Josh
>|||jxstern (jxstern@.nowhere.xyz) writes:
> We start developing version 2 of the database, and though we've made
> minimal changes to these routines, changing parameter one from GUID to
> Int, same as we've done to hundreds of routines, suddenly these
> routines run 1000x more slowly (both reads and CPU) when called from
> the app. The same commands taken from a trace log and run in QA run
> at full speed. OK, this happens and is hard to track down, but here's
> the kicker. Turns out parameter two was called @.foo_date but was
> declared as varchar(32), the better to append a time of day to it when
> passed in, I guess. Well, we redeclared it as the datetime it should
> have been, and voila, speed is back to normal.
> OK, I understand why this might fix things, but I do not understand
> why it was not also broken in the V1 database, and not broken even in
> V2 when called from QA.
> Voodoo is a good explanation, but I'm open to others.
Voodoo is rarely an accurate explanation to these sort of problems. But
unfortunately, the way people present the problems, the amount of
information presented is so incomplete, that there is not much more to
suggest that just voodoo.
Andrew offered some speculations. I could offer a few more about clients
and Query Analyzer having different default settings for ARITHBORT ON.
But really, without the seeing the code, the tables and how it was called,
I really don't want to go into speculation.
But as a hint, performing problems in SQL Server are rarely resovled
by sticking pins into dolls of Bill Gates and Steve Ballmer.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||On Fri, 26 Aug 2005 21:11:41 -0400, "Andrew J. Kelly"
<sqlmvpnooospam@.shadhawk.com> wrote:
>When you called it from the app you most likely have a parameter object tha
t
>tells it what the datatype is. In this case a varchar. When you run it
>adhoc in QA it most likely did an implicit conversion to datetime as it
>passed it in to the sp. You should always declare the parameters to be
>exactly what they need to be to correspond to the columns you are matching
>them to in the WHERE clause. Other wise you leave it up to chance as to
>what you get.
The code in V2 is something like:
create procedure dbo.myfoov2(
myrowid int,
@.foo_date varchar(32)
)
as
begin
declare @.realdate datetime
set @.realdate = @.foo_date + ' 23.59.997'
...
end
The invocation is something like:
exec dbo.myfoov1 @.myrowid = 123, @.foo_date = '8/24/2005'
The declaration and code are the same in the V1 and V2 databases. I
can't see how QA or ODBC or whatever would know to coerce the string
one way or another.
Sure, *something* must be different, one would suspect some more
direct use of @.foo_date down in the body of the code that, in one
case, the optimizer recognizes as deterministic and in the other case
it does not.
About the only change I know of is that in V1 we were using GUIDs:
create procedure dbo.myfoov1(
myrowid uniqueidentifier, <--
@.foo_date varchar(32)
)
...
And of course the invocation used GUIDs not ints.
But why that should have a side-effect on the coercion farther down of
@.foo_date, ... does that question trigger anything for anybody?
Unlikely, I know, but if it were obvious I wouldn't be asking.
Thanks.
J.|||Well what was the query plan difference between the slow and fast ones? I
have to assume the fast one was using an index and the slow one wasn't.
It's hard to believe the datetime (or varchar) played too much a part since
it isn't used in the WHERE clause. Or at least I assume it doesn't since
you didn't actually show that part<g>. Knowing what the difference in the
plans will mainly dictate where to look.
Andrew J. Kelly SQL MVP
"JXStern" <JXSternChangeX2R@.gte.net> wrote in message
news:8j34h1lj1u80l8jtngtlnfkh4h67oq9onp@.
4ax.com...
> On Fri, 26 Aug 2005 21:11:41 -0400, "Andrew J. Kelly"
> <sqlmvpnooospam@.shadhawk.com> wrote:
> The code in V2 is something like:
> create procedure dbo.myfoov2(
> myrowid int,
> @.foo_date varchar(32)
> )
> as
> begin
> declare @.realdate datetime
> set @.realdate = @.foo_date + ' 23.59.997'
> ...
> end
> The invocation is something like:
> exec dbo.myfoov1 @.myrowid = 123, @.foo_date = '8/24/2005'
> The declaration and code are the same in the V1 and V2 databases. I
> can't see how QA or ODBC or whatever would know to coerce the string
> one way or another.
> Sure, *something* must be different, one would suspect some more
> direct use of @.foo_date down in the body of the code that, in one
> case, the optimizer recognizes as deterministic and in the other case
> it does not.
> About the only change I know of is that in V1 we were using GUIDs:
> create procedure dbo.myfoov1(
> myrowid uniqueidentifier, <--
> @.foo_date varchar(32)
> )
> ...
> And of course the invocation used GUIDs not ints.
> But why that should have a side-effect on the coercion farther down of
> @.foo_date, ... does that question trigger anything for anybody?
> Unlikely, I know, but if it were obvious I wouldn't be asking.
> Thanks.
> J.
>|||On Sun, 28 Aug 2005 19:08:18 -0400, "Andrew J. Kelly"
<sqlmvpnooospam@.shadhawk.com> wrote:
>Well what was the query plan difference between the slow and fast ones? I
>have to assume the fast one was using an index and the slow one wasn't.
>It's hard to believe the datetime (or varchar) played too much a part since
>it isn't used in the WHERE clause. Or at least I assume it doesn't since
>you didn't actually show that part<g>. Knowing what the difference in the
>plans will mainly dictate where to look.
The actual routines were long and complex, and I'll have to break this
again (my luck, it won't break!) to get a bad plan to compare.
The question will remain, however, why the plans differed, given the
setup.
J.

A fix for slow running SP, but why?

OK, so we have these three SPs that are causing no problem.
We start developing version 2 of the database, and though we've made
minimal changes to these routines, changing parameter one from GUID to
Int, same as we've done to hundreds of routines, suddenly these
routines run 1000x more slowly (both reads and CPU) when called from
the app. The same commands taken from a trace log and run in QA run
at full speed. OK, this happens and is hard to track down, but here's
the kicker. Turns out parameter two was called @.foo_date but was
declared as varchar(32), the better to append a time of day to it when
passed in, I guess. Well, we redeclared it as the datetime it should
have been, and voila, speed is back to normal.
OK, I understand why this might fix things, but I do not understand
why it was not also broken in the V1 database, and not broken even in
V2 when called from QA.
Voodoo is a good explanation, but I'm open to others.
Could it be a change in the clients? Well, we actually invoked these
SPs from a couple of different clients, some were unchanged (well,
except for the new datatype of parameter one!). But that still
wouldn't really explain why it was still OK when called from QA.
Thanks!
Josh
When you called it from the app you most likely have a parameter object that
tells it what the datatype is. In this case a varchar. When you run it
adhoc in QA it most likely did an implicit conversion to datetime as it
passed it in to the sp. You should always declare the parameters to be
exactly what they need to be to correspond to the columns you are matching
them to in the WHERE clause. Other wise you leave it up to chance as to
what you get.
Andrew J. Kelly SQL MVP
"jxstern" <jxstern@.nowhere.xyz> wrote in message
news:ecbvg1h8rrq1e8mc9rm42k98a40g064ac2@.4ax.com...
> OK, so we have these three SPs that are causing no problem.
> We start developing version 2 of the database, and though we've made
> minimal changes to these routines, changing parameter one from GUID to
> Int, same as we've done to hundreds of routines, suddenly these
> routines run 1000x more slowly (both reads and CPU) when called from
> the app. The same commands taken from a trace log and run in QA run
> at full speed. OK, this happens and is hard to track down, but here's
> the kicker. Turns out parameter two was called @.foo_date but was
> declared as varchar(32), the better to append a time of day to it when
> passed in, I guess. Well, we redeclared it as the datetime it should
> have been, and voila, speed is back to normal.
> OK, I understand why this might fix things, but I do not understand
> why it was not also broken in the V1 database, and not broken even in
> V2 when called from QA.
> Voodoo is a good explanation, but I'm open to others.
> Could it be a change in the clients? Well, we actually invoked these
> SPs from a couple of different clients, some were unchanged (well,
> except for the new datatype of parameter one!). But that still
> wouldn't really explain why it was still OK when called from QA.
> Thanks!
> Josh
>
|||jxstern (jxstern@.nowhere.xyz) writes:
> We start developing version 2 of the database, and though we've made
> minimal changes to these routines, changing parameter one from GUID to
> Int, same as we've done to hundreds of routines, suddenly these
> routines run 1000x more slowly (both reads and CPU) when called from
> the app. The same commands taken from a trace log and run in QA run
> at full speed. OK, this happens and is hard to track down, but here's
> the kicker. Turns out parameter two was called @.foo_date but was
> declared as varchar(32), the better to append a time of day to it when
> passed in, I guess. Well, we redeclared it as the datetime it should
> have been, and voila, speed is back to normal.
> OK, I understand why this might fix things, but I do not understand
> why it was not also broken in the V1 database, and not broken even in
> V2 when called from QA.
> Voodoo is a good explanation, but I'm open to others.
Voodoo is rarely an accurate explanation to these sort of problems. But
unfortunately, the way people present the problems, the amount of
information presented is so incomplete, that there is not much more to
suggest that just voodoo.
Andrew offered some speculations. I could offer a few more about clients
and Query Analyzer having different default settings for ARITHBORT ON.
But really, without the seeing the code, the tables and how it was called,
I really don't want to go into speculation.
But as a hint, performing problems in SQL Server are rarely resovled
by sticking pins into dolls of Bill Gates and Steve Ballmer.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
|||On Fri, 26 Aug 2005 21:11:41 -0400, "Andrew J. Kelly"
<sqlmvpnooospam@.shadhawk.com> wrote:
>When you called it from the app you most likely have a parameter object that
>tells it what the datatype is. In this case a varchar. When you run it
>adhoc in QA it most likely did an implicit conversion to datetime as it
>passed it in to the sp. You should always declare the parameters to be
>exactly what they need to be to correspond to the columns you are matching
>them to in the WHERE clause. Other wise you leave it up to chance as to
>what you get.
The code in V2 is something like:
create procedure dbo.myfoov2(
myrowid int,
@.foo_date varchar(32)
)
as
begin
declare @.realdate datetime
set @.realdate = @.foo_date + ' 23.59.997'
...
end
The invocation is something like:
exec dbo.myfoov1 @.myrowid = 123, @.foo_date = '8/24/2005'
The declaration and code are the same in the V1 and V2 databases. I
can't see how QA or ODBC or whatever would know to coerce the string
one way or another.
Sure, *something* must be different, one would suspect some more
direct use of @.foo_date down in the body of the code that, in one
case, the optimizer recognizes as deterministic and in the other case
it does not.
About the only change I know of is that in V1 we were using GUIDs:
create procedure dbo.myfoov1(
myrowid uniqueidentifier, <--
@.foo_date varchar(32)
)
...
And of course the invocation used GUIDs not ints.
But why that should have a side-effect on the coercion farther down of
@.foo_date, ... does that question trigger anything for anybody?
Unlikely, I know, but if it were obvious I wouldn't be asking.
Thanks.
J.
|||Well what was the query plan difference between the slow and fast ones? I
have to assume the fast one was using an index and the slow one wasn't.
It's hard to believe the datetime (or varchar) played too much a part since
it isn't used in the WHERE clause. Or at least I assume it doesn't since
you didn't actually show that part<g>. Knowing what the difference in the
plans will mainly dictate where to look.
Andrew J. Kelly SQL MVP
"JXStern" <JXSternChangeX2R@.gte.net> wrote in message
news:8j34h1lj1u80l8jtngtlnfkh4h67oq9onp@.4ax.com...
> On Fri, 26 Aug 2005 21:11:41 -0400, "Andrew J. Kelly"
> <sqlmvpnooospam@.shadhawk.com> wrote:
> The code in V2 is something like:
> create procedure dbo.myfoov2(
> myrowid int,
> @.foo_date varchar(32)
> )
> as
> begin
> declare @.realdate datetime
> set @.realdate = @.foo_date + ' 23.59.997'
> ...
> end
> The invocation is something like:
> exec dbo.myfoov1 @.myrowid = 123, @.foo_date = '8/24/2005'
> The declaration and code are the same in the V1 and V2 databases. I
> can't see how QA or ODBC or whatever would know to coerce the string
> one way or another.
> Sure, *something* must be different, one would suspect some more
> direct use of @.foo_date down in the body of the code that, in one
> case, the optimizer recognizes as deterministic and in the other case
> it does not.
> About the only change I know of is that in V1 we were using GUIDs:
> create procedure dbo.myfoov1(
> myrowid uniqueidentifier, <--
> @.foo_date varchar(32)
> )
> ...
> And of course the invocation used GUIDs not ints.
> But why that should have a side-effect on the coercion farther down of
> @.foo_date, ... does that question trigger anything for anybody?
> Unlikely, I know, but if it were obvious I wouldn't be asking.
> Thanks.
> J.
>
|||On Sun, 28 Aug 2005 19:08:18 -0400, "Andrew J. Kelly"
<sqlmvpnooospam@.shadhawk.com> wrote:
>Well what was the query plan difference between the slow and fast ones? I
>have to assume the fast one was using an index and the slow one wasn't.
>It's hard to believe the datetime (or varchar) played too much a part since
>it isn't used in the WHERE clause. Or at least I assume it doesn't since
>you didn't actually show that part<g>. Knowing what the difference in the
>plans will mainly dictate where to look.
The actual routines were long and complex, and I'll have to break this
again (my luck, it won't break!) to get a bad plan to compare.
The question will remain, however, why the plans differed, given the
setup.
J.

A fix for slow running SP, but why?

OK, so we have these three SPs that are causing no problem.
We start developing version 2 of the database, and though we've made
minimal changes to these routines, changing parameter one from GUID to
Int, same as we've done to hundreds of routines, suddenly these
routines run 1000x more slowly (both reads and CPU) when called from
the app. The same commands taken from a trace log and run in QA run
at full speed. OK, this happens and is hard to track down, but here's
the kicker. Turns out parameter two was called @.foo_date but was
declared as varchar(32), the better to append a time of day to it when
passed in, I guess. Well, we redeclared it as the datetime it should
have been, and voila, speed is back to normal.
OK, I understand why this might fix things, but I do not understand
why it was not also broken in the V1 database, and not broken even in
V2 when called from QA.
Voodoo is a good explanation, but I'm open to others.
Could it be a change in the clients? Well, we actually invoked these
SPs from a couple of different clients, some were unchanged (well,
except for the new datatype of parameter one!). But that still
wouldn't really explain why it was still OK when called from QA.
Thanks!
JoshWhen you called it from the app you most likely have a parameter object that
tells it what the datatype is. In this case a varchar. When you run it
adhoc in QA it most likely did an implicit conversion to datetime as it
passed it in to the sp. You should always declare the parameters to be
exactly what they need to be to correspond to the columns you are matching
them to in the WHERE clause. Other wise you leave it up to chance as to
what you get.
--
Andrew J. Kelly SQL MVP
"jxstern" <jxstern@.nowhere.xyz> wrote in message
news:ecbvg1h8rrq1e8mc9rm42k98a40g064ac2@.4ax.com...
> OK, so we have these three SPs that are causing no problem.
> We start developing version 2 of the database, and though we've made
> minimal changes to these routines, changing parameter one from GUID to
> Int, same as we've done to hundreds of routines, suddenly these
> routines run 1000x more slowly (both reads and CPU) when called from
> the app. The same commands taken from a trace log and run in QA run
> at full speed. OK, this happens and is hard to track down, but here's
> the kicker. Turns out parameter two was called @.foo_date but was
> declared as varchar(32), the better to append a time of day to it when
> passed in, I guess. Well, we redeclared it as the datetime it should
> have been, and voila, speed is back to normal.
> OK, I understand why this might fix things, but I do not understand
> why it was not also broken in the V1 database, and not broken even in
> V2 when called from QA.
> Voodoo is a good explanation, but I'm open to others.
> Could it be a change in the clients? Well, we actually invoked these
> SPs from a couple of different clients, some were unchanged (well,
> except for the new datatype of parameter one!). But that still
> wouldn't really explain why it was still OK when called from QA.
> Thanks!
> Josh
>|||jxstern (jxstern@.nowhere.xyz) writes:
> We start developing version 2 of the database, and though we've made
> minimal changes to these routines, changing parameter one from GUID to
> Int, same as we've done to hundreds of routines, suddenly these
> routines run 1000x more slowly (both reads and CPU) when called from
> the app. The same commands taken from a trace log and run in QA run
> at full speed. OK, this happens and is hard to track down, but here's
> the kicker. Turns out parameter two was called @.foo_date but was
> declared as varchar(32), the better to append a time of day to it when
> passed in, I guess. Well, we redeclared it as the datetime it should
> have been, and voila, speed is back to normal.
> OK, I understand why this might fix things, but I do not understand
> why it was not also broken in the V1 database, and not broken even in
> V2 when called from QA.
> Voodoo is a good explanation, but I'm open to others.
Voodoo is rarely an accurate explanation to these sort of problems. But
unfortunately, the way people present the problems, the amount of
information presented is so incomplete, that there is not much more to
suggest that just voodoo.
Andrew offered some speculations. I could offer a few more about clients
and Query Analyzer having different default settings for ARITHBORT ON.
But really, without the seeing the code, the tables and how it was called,
I really don't want to go into speculation.
But as a hint, performing problems in SQL Server are rarely resovled
by sticking pins into dolls of Bill Gates and Steve Ballmer.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp|||On Fri, 26 Aug 2005 21:11:41 -0400, "Andrew J. Kelly"
<sqlmvpnooospam@.shadhawk.com> wrote:
>When you called it from the app you most likely have a parameter object that
>tells it what the datatype is. In this case a varchar. When you run it
>adhoc in QA it most likely did an implicit conversion to datetime as it
>passed it in to the sp. You should always declare the parameters to be
>exactly what they need to be to correspond to the columns you are matching
>them to in the WHERE clause. Other wise you leave it up to chance as to
>what you get.
The code in V2 is something like:
create procedure dbo.myfoov2(
myrowid int,
@.foo_date varchar(32)
)
as
begin
declare @.realdate datetime
set @.realdate = @.foo_date + ' 23.59.997'
...
end
The invocation is something like:
exec dbo.myfoov1 @.myrowid = 123, @.foo_date = '8/24/2005'
The declaration and code are the same in the V1 and V2 databases. I
can't see how QA or ODBC or whatever would know to coerce the string
one way or another.
Sure, *something* must be different, one would suspect some more
direct use of @.foo_date down in the body of the code that, in one
case, the optimizer recognizes as deterministic and in the other case
it does not.
About the only change I know of is that in V1 we were using GUIDs:
create procedure dbo.myfoov1(
myrowid uniqueidentifier, <--
@.foo_date varchar(32)
)
...
And of course the invocation used GUIDs not ints.
But why that should have a side-effect on the coercion farther down of
@.foo_date, ... does that question trigger anything for anybody?
Unlikely, I know, but if it were obvious I wouldn't be asking.
Thanks.
J.|||Well what was the query plan difference between the slow and fast ones? I
have to assume the fast one was using an index and the slow one wasn't.
It's hard to believe the datetime (or varchar) played too much a part since
it isn't used in the WHERE clause. Or at least I assume it doesn't since
you didn't actually show that part<g>. Knowing what the difference in the
plans will mainly dictate where to look.
--
Andrew J. Kelly SQL MVP
"JXStern" <JXSternChangeX2R@.gte.net> wrote in message
news:8j34h1lj1u80l8jtngtlnfkh4h67oq9onp@.4ax.com...
> On Fri, 26 Aug 2005 21:11:41 -0400, "Andrew J. Kelly"
> <sqlmvpnooospam@.shadhawk.com> wrote:
>>When you called it from the app you most likely have a parameter object
>>that
>>tells it what the datatype is. In this case a varchar. When you run it
>>adhoc in QA it most likely did an implicit conversion to datetime as it
>>passed it in to the sp. You should always declare the parameters to be
>>exactly what they need to be to correspond to the columns you are matching
>>them to in the WHERE clause. Other wise you leave it up to chance as to
>>what you get.
> The code in V2 is something like:
> create procedure dbo.myfoov2(
> myrowid int,
> @.foo_date varchar(32)
> )
> as
> begin
> declare @.realdate datetime
> set @.realdate = @.foo_date + ' 23.59.997'
> ...
> end
> The invocation is something like:
> exec dbo.myfoov1 @.myrowid = 123, @.foo_date = '8/24/2005'
> The declaration and code are the same in the V1 and V2 databases. I
> can't see how QA or ODBC or whatever would know to coerce the string
> one way or another.
> Sure, *something* must be different, one would suspect some more
> direct use of @.foo_date down in the body of the code that, in one
> case, the optimizer recognizes as deterministic and in the other case
> it does not.
> About the only change I know of is that in V1 we were using GUIDs:
> create procedure dbo.myfoov1(
> myrowid uniqueidentifier, <--
> @.foo_date varchar(32)
> )
> ...
> And of course the invocation used GUIDs not ints.
> But why that should have a side-effect on the coercion farther down of
> @.foo_date, ... does that question trigger anything for anybody?
> Unlikely, I know, but if it were obvious I wouldn't be asking.
> Thanks.
> J.
>|||On Sun, 28 Aug 2005 19:08:18 -0400, "Andrew J. Kelly"
<sqlmvpnooospam@.shadhawk.com> wrote:
>Well what was the query plan difference between the slow and fast ones? I
>have to assume the fast one was using an index and the slow one wasn't.
>It's hard to believe the datetime (or varchar) played too much a part since
>it isn't used in the WHERE clause. Or at least I assume it doesn't since
>you didn't actually show that part<g>. Knowing what the difference in the
>plans will mainly dictate where to look.
The actual routines were long and complex, and I'll have to break this
again (my luck, it won't break!) to get a bad plan to compare.
The question will remain, however, why the plans differed, given the
setup.
J.