Wednesday, March 28, 2012
Intermittent issue with outer joins on subqueries
MSSQL joins on subqueries. The below query is run daily by a scheduled
task and usually runs correctly. About once a week the query produces
a resultset that makes it appear that the outer join on the subquery
(alias: POINFO) was changed to an inner join. The resultset has only a
percentage of the records it should have as a result. Are there any
know issues with MSSQL 2000 SP4 that are know to cause this. BTW, the
problem happens on a Win2000 server. Thanks.
SELECT *
FROM rc.dbo.LineItems LI
INNER JOIN rc.dbo.orders O
ON O.guidPK = LI.orderguidPK
INNER JOIN decode DECODE
ON O.status = DECODE.status
INNER JOIN products P
ON LI.productPK = P.PK
/* The below join periodically seems to become an inner join
*/
LEFT OUTER JOIN (SELECT PO.OrderNumber, FP.ProductNumber
from purchase_orders PO
INNER JOIN purchase_orders_lines POL
ON PO.PK = POL.purchaseorderPK
INNER JOIN fulfillment_products FP
ON POL.intProductID = FP.PK AND PO.supplierPK = FP.supplierPK
INNER JOIN I18NManufacturer MAN
ON FP.manPK = MAN.PK
INNER JOIN suppliers S
ON FP.supplierPK = SM.PK
WHERE PO.status <>9 AND MAN.locale = 1041) AS POINFO
ON O.order_number = POINFO.order_number AND LI.productPK = POINFO.productPK
WHERE O.order_type <> 1 and O.active=1
and O.status between 2 and 32Can you capture the plan when the bad result happens, and compare it to the
normal plan?
(In other words, does it happen frequently enough that if you tried, you
could reproduce the problem in Query Analyzer?)
"Jesse Hogan" <JesseHogan0@.gmail.com> wrote in message
news:049ac85e-1cde-4fd9-8755-0b03494302d2@.1g2000hsl.googlegroups.com...
> Hello, we are running into an issue which seems to be a bug in the way
> MSSQL joins on subqueries. The below query is run daily by a scheduled
> task and usually runs correctly. About once a week the query produces
> a resultset that makes it appear that the outer join on the subquery
> (alias: POINFO) was changed to an inner join. The resultset has only a
> percentage of the records it should have as a result. Are there any
> know issues with MSSQL 2000 SP4 that are know to cause this. BTW, the
> problem happens on a Win2000 server. Thanks.
> SELECT *
> FROM rc.dbo.LineItems LI
> INNER JOIN rc.dbo.orders O
> ON O.guidPK = LI.orderguidPK
> INNER JOIN decode DECODE
> ON O.status = DECODE.status
> INNER JOIN products P
> ON LI.productPK = P.PK
> /* The below join periodically seems to become an inner join
> */
> LEFT OUTER JOIN (SELECT PO.OrderNumber, FP.ProductNumber
> from purchase_orders PO
> INNER JOIN purchase_orders_lines POL
> ON PO.PK = POL.purchaseorderPK
> INNER JOIN fulfillment_products FP
> ON POL.intProductID = FP.PK AND PO.supplierPK = FP.supplierPK
> INNER JOIN I18NManufacturer MAN
> ON FP.manPK = MAN.PK
> INNER JOIN suppliers S
> ON FP.supplierPK = SM.PK
> WHERE PO.status <>9 AND MAN.locale = 1041) AS POINFO
> ON O.order_number = POINFO.order_number AND LI.productPK => POINFO.productPK
> WHERE O.order_type <> 1 and O.active=1
> and O.status between 2 and 32|||I would be much more likely to think the WHERE clause is limiting the rows
'unexpectedly'. Perhaps you should set up an audit trail whereby you store
the COUNT(*) of the entire SELECT as well as the COUNT(*) for the SELECT
without the join to POINFO by itself into a table each time this process is
run (with enough identifying information added to ensure you can pinpoint
the rows for each run). This will help you see if you are affecting fewer
rows with the main query simply because of the WHERE clause or is the LOJ
magically translating into an INNER JOIN. That will give you definitive
evidence to take to Microsoft if it is a bug too (which I will definitely
admit isn't out of the question). :-)
Doing a quick check of post-SP4 hotfixes, see if this one applies
http://support.microsoft.com/kb/892310/
--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"Jesse Hogan" <JesseHogan0@.gmail.com> wrote in message
news:049ac85e-1cde-4fd9-8755-0b03494302d2@.1g2000hsl.googlegroups.com...
> Hello, we are running into an issue which seems to be a bug in the way
> MSSQL joins on subqueries. The below query is run daily by a scheduled
> task and usually runs correctly. About once a week the query produces
> a resultset that makes it appear that the outer join on the subquery
> (alias: POINFO) was changed to an inner join. The resultset has only a
> percentage of the records it should have as a result. Are there any
> know issues with MSSQL 2000 SP4 that are know to cause this. BTW, the
> problem happens on a Win2000 server. Thanks.
> SELECT *
> FROM rc.dbo.LineItems LI
> INNER JOIN rc.dbo.orders O
> ON O.guidPK = LI.orderguidPK
> INNER JOIN decode DECODE
> ON O.status = DECODE.status
> INNER JOIN products P
> ON LI.productPK = P.PK
> /* The below join periodically seems to become an inner join
> */
> LEFT OUTER JOIN (SELECT PO.OrderNumber, FP.ProductNumber
> from purchase_orders PO
> INNER JOIN purchase_orders_lines POL
> ON PO.PK = POL.purchaseorderPK
> INNER JOIN fulfillment_products FP
> ON POL.intProductID = FP.PK AND PO.supplierPK = FP.supplierPK
> INNER JOIN I18NManufacturer MAN
> ON FP.manPK = MAN.PK
> INNER JOIN suppliers S
> ON FP.supplierPK = SM.PK
> WHERE PO.status <>9 AND MAN.locale = 1041) AS POINFO
> ON O.order_number = POINFO.order_number AND LI.productPK => POINFO.productPK
> WHERE O.order_type <> 1 and O.active=1
> and O.status between 2 and 32
Wednesday, March 21, 2012
Interesting Data Flow task Problem
hi i have an issue in Dataflow task basically i have 10 or more Dataflow tasks in a package and i intend to do is capture the Input FileName and Destination Name of that DataFlow Task into a Sql server Table.
I donot want to hard code but is there a way of storing these names in variables or getting the name from dts runtime properties to store them into a table.
My purpose to capture these values is to log these values along with error rows into a table.
A data flow can have more than one input/output. In fact, a data flow doesn't even have to have an input or an output that is external to the flow. (You can have a script source... You can omit a destination entirely because maybe you just need to execute an OLE DB Command transformation for every row...)I'm not entirely clear on your question/problem... How does each data flow (of the 10 or more) know what source and destinations to use? Isn't that hardcoded?|||
the connection managers for the source and destination are dynamic from configuration table in sql server and what i am trying to do is in case of error log the source filename , destination table name with error row and description into a error table.
i am confused about how to get the actual file name and destination table name , in my case i use seperate DFT dataflow task for each separate table to load.
|||
Dev2624 wrote:
the connection managers for the source and destination are dynamic from configuration table in sql server and what i am trying to do is in case of error log the source filename , destination table name with error row and description into a error table.
i am confused about how to get the actual file name and destination table name , in my case i use seperate DFT dataflow task for each separate table to load.
Are you assigning the source and destination to the ConnectionString parameters, or are you assigning them to a variable?
You can hook the configuration table connectionstring parameters up to package variables, and then use the variables in the connection manager's expression property for ConnectionString. Then, since the configuration is in a variable, simply copy the variable's value to your logging output. Basically.
Monday, March 12, 2012
Interactive reports in ASP.NET application
Hi, I am looking for some guidance on the way to go for achieving the task described below.
I am working on a project to generate various statistical reports for the Revenue managers.
The application is aimed to be a browser based application usingASP.NET. The reports shall be interactive with all the functionalities like annotations, dynamically changing the range of the x-axis and report-click should take the user to a new report/web page, context menus, multiple reports on the same page - charts and matrix/tabular.
My boss is envisioning the applications to have interactive charts just like those you find on the Yahoo Finance website.http://finance.yahoo.com/charts. They seem to be using the Flash player.
Questions:
- We have a license for SQL Server 2005 reporting services. We had a hard time incorporating the SQL Server reports into the
ASP.NET AJAX enabled web application, using the ReportViewer control that comes along with VS2005, and they are pretty much static. Is there a better approach? I have looked at Dundas Charts they don't quite seem to be as interactive as the google finance and yahoo finance charts.Is the same thing possible without SSRS?. In terms of having Flash like report interactivity on the webpages?.Do Silverlight and/or WPF offer me the capability of building a RIA ASP.NET website (Rich Internet Application) with support for charting.
Any reponse is appreciated.
Thanks
Your boss is envisioning something that has taken a lot of work to put together. Have you checked how much he's willing to invest?
As to the questions:
1. Dundas charts is pretty much the top of the game as far as 3rd party charting components goes. Especially for charts that integrate with SSRS
2. Yes. You need to do a bit (lot) more work. Get the data yourself, format it yourself, present it yourself. Google and Yahoo look so good because they spend a lot of time getting each chart just right, and they're all custom built.
3. Silverlight. You should be able to do something like this, buit it might take a bit more work to get right. 3rd party Flash based charting is probably easier as a starting point.
|||Thanks for the response.
I have come accross Adobe Flex 2, which boasts of its highly interactive rich charing controls of presentation on client browsers.
Can we integrate ASP.NET applications with those client components developed etc.
Just curious.
Thanks.
|||I don't know about the Adobe Flex charts but the I've used Infosoft Global Charts in an Asp.Net application with good results. They are also Flash charts that allow for some good interactivity with moseovers and onclicks. You pass data to them in XML format and they animate very nicely. They also have a good JavaScript library so you can set/reset the data on the client-side in order to refresh them via Ajax if necessary.
Here's a link to their chart gallery.
http://www.fusioncharts.com/Gallery.asp
Hope this helps,
Al
|||alcsharp, Thank you so much.
I will check it right away. I am leaving this post open for now so I can get more ideas from the folks.
Later!
Interactive Reporting in ASP.NET using SSRS (2005)
Hi, I am looking for some guidance on the way to go for achieving the task described below.
I am working on a project to generate various statistical reports for the Revenue managers.
The application is aimed to be a browser based application usingASP.NET. The reports shall be interactive with all the functionalities like annotations, dynamically changing the range of the x-axis and report-click should take the user to a new report/web page, context menus, multiple reports on the same page - charts and matrix/tabular.
My boss is envisioning the applications to have interactive charts just like those you find on the Yahoo Finance website.http://finance.yahoo.com/charts. They seem to be using the Flash player.
Questions:
- We have a license for SQL Server 2005 reporting services. We had a hard time incorporating the SQL Server reports into the
ASP.NET AJAX enabled web application, using the ReportViewer control that comes along with VS2005, and they are pretty much static. Is there a better approach? I have looked at Dundas Charts they don't quite seem to be as interactive as the google finance and yahoo finance charts.Is the same thing possible without SSRS?. In terms of having Flash like report interactivity on the webpages?.Do Silverlight and/or WPF offer me the capability of building a RIA ASP.NET website (Rich Internet Application) with support for charting.
Any reponse is appreciated.
Thanks
Try the Digital Dashboards & Executive Dashboards.
http://www.dundas.com/Dashboards/index.aspx?Campaign=ASPAlliancePS
|||Thanks Momo_Stev,
I have taken a look at them, however they lack a little on the rich presentation side. After I posted this query, I came accross the below article which sounds to be doable in my case.
Article breifly explains how to integrate Flash into client side with ASP.NET server scripting.
http://www.4guysfromrolla.com/webtech/032603-1.shtml
Thank you.