Showing posts with label sproc. Show all posts
Showing posts with label sproc. Show all posts

Friday, March 30, 2012

Question about sproc performance?

whats the difference in performance between these two scenarioes...

Suppose if i build a sproc to insert or update into one table and then take its primary key and insert and update subsequent tables may one or 2 or more take more time in exceuting...

or

writing indivdual sproc for insert and update for particular table in different sproc and then calling all the sprocs in a master proc using exec sproc command...

Which scenario would better if they are around 230 or 300 or more than records.

Hope some would shed some light into this..

Any help is appreciated...

Regards

Karen

The best advise I can give is to build both of them. You can then look at the individual execution plans of them both and determine which is the better approach for your database. It should also help to highlight if any indexes need to be added to your tables.

|||

I dont think it will be too much of a noticeable difference.. unless you have some very complex logic involving several IF loops which radically changes the WHERE conditions in the query.

|||

Thanks Dinakar...

I just plain inserts and updates...to different tables... and in the above scenario which is best approach to take?

Regards

Karen

|||

If its plain INSERTs/UPDATEs its more of a convenience and easier maintenance that you should decide based on rather than performance. I would create one proc for each table that takes care of INSERT and UPDATE (Depending on whether record exists or not) so you can re-use the procs. If you put multiple tables related INSERTs into one proc and later if you had to do an INSERTt/UPDATE into one of those 2 tables, you'd be re-writing the same logic into another proc again. If you created a separate proc for the table now, you could just call the proc later.

Friday, March 9, 2012

question about charts

I have a pie chart which is been populated from a sproc.

and for a particular fund the values that generate are 78%,20% and 2% respectively.

And when it generates a chart the pie chart is uniformly displayed... Like for eg.. its been broken into 3 parts and there isnt a difference between the 78% and the 2% so ... How can i get the pie chart to be a displayed according to its values..

Any help will be appreciated..

Regards

Karen

So you are saying that each piece of the pie is showing as one third of the pie instead of being divided according to the percentage if you have three values in the pie chart?

Have you tried an exploded pie with 3D effects? Have you displayed the value for each piece of the pie on the chart?

Since it is a pie chart, it should naturally divide the pie according to the values in the chart.

If not, it would be like a bar graph with all of the bars at the same height when the values were in fact different.

|||

i have a exploded pie chart ... in design mode i can see the differences but not when i preview it..

Regards

KAren

|||

So when you preview it you can see the percentages over the pieces of the pie, but it looks as if it's not dividing it accordingly?

I'm making sure I understand the problem...

|||Maybe it's having a problem with the percentage itself. Is your field in itself a percentage? If so, I don't think it should be. The field itself should be a number (not a percentage) and the pie chart will divide the number by the total to get the percentage behind the scenes. You don't need to make it a percentage yourself.|||

greg,

The fields is varchar field in Sql server and i am not doing any thing special in the report..

78% part should be bigger than 2 % but 78% and 2% are the same size.

So how can i solve it

Regards

Karen

|||

i changed the datatype to decimal and it works fine.

Thanks

Regards,

Karen

Question about chart legend

I have a chart and i am populating it from a sproc.

In the Legend i am getting InvestmentPercent.Value- InvestmentName.Value - InvestmentPercent.Value

How can I just display InvestmentPercent.Value - InvestmentName.value

In the graph it looks

3- cash -3

38 - FixedIncome -38

how can I set this thing right...

Regards

Karen

Karen,

I think what you are wanting to do is simply change the series label. Right click your chart -> properties -> data tab.

Click on the Value whose legend label you want to change. Then click Edit. Change the series label (not the value) to what you want.

If these steps are confusing, let me know and i'll post a screen shot.

|||

Can you pls post a screen shot.

Regards,

Karen

|||http://i55.photobucket.com/albums/g121/Farsight38/chart.jpg

http://i55.photobucket.com/albums/g121/Farsight38/chart2.jpg

If this isn't self explanatory, let me know.

|||

Greg,

Thanks for ur answer. it doesnt work.. having the same problem.

My sproc is as follows

ALTER Procedure [dbo].[rpt_FundAssetAllocation]

@.Cusip varchar(9)

AS

--temp dev code

/*declare @.Cusip varchar(9)

SET @.Cusip = '337739205' */

DECLARE

@.Period int

SELECT

@.Period = MAX([PeriodId])

FROM

FundAssetAllocation

WHERE

Cusip= @.Cusip

--==============================================================================

-- Return the appropriate data.

--==============================================================================

SELECT

Cusip,

InvestmentName,

InvestmentPercent

FROM

FundAssetAllocation

WHERE

Cusip = @.Cusip

AND

PeriodId = @.Period

So I have taken a Pie chart right clicked on it

and i have 2 values

the First one has the Following Series Label

=Fields!InvestmentPercent.Value + "% " + Fields!InvestmentName.Value and its Value is

=Count(Fields!InvestmentName.Value)

The second one is Value 2

which has the series Label of No value and its Value is

=Fields!InvestmentPercent.Value

The i also have a Series Group

Which i am grouping by Fields!Cusip.Value..

But when i preview it i am Getting the following legend

30 - 30% Intenational Stocks

40 - 40% U.S Mid/Large Cap Stock.

Regards

Karen

|||I'm not sure how to explain this, but I have seen occurances where the series label "sticks". I would change the series label to various things and see if you can get it to change to anything else.

|||

Thanks i will look into it. and i have another small problem. when i run the data set i have 3 records but when i plot it only 2 of them come up any idea why.

This is my Dataset

337739692 International Stocks 30
337739692 U.S. Mid/Large Cap Stock 40
337739692 U.S. Small Cap Stocks 30

and in the graph only the First 2 appear.

Any Help will be appreciated.

Regards,

Karen

|||

Greg,

thanks a Lot... I fixed it.. By removing the SeriesLabel in the values.

and about my previous post.. after fixing that it works Fine...

Regards

Karen