Showing posts with label creating. Show all posts
Showing posts with label creating. Show all posts

Saturday, February 25, 2012

Avoiding Extra page in printing

Hi,
I have finally worked my way through the process of creating a semi complex
report. It looks good. I like the product and have found it rich in neat
features.
However, it offers a page break option on table groups of either at the
start of the group or at the end of a group. The end of the group choice
displays properly in HTML however when I use the print icon on the print
toolbar, it prints an extra page because it breaks at the end of the last
group. Is there a way of turning off that final break at the end of print?
Thanks,
hughHi Hugh,
I understood it wil be a blank page for your
Please set PageBreakAtStart to be True and set PageBreakAtEnd to be False
to see whether it could resolve this.
If above does not work, would you please generate a sample rdl file with
AdventureWorks for me to reproduce it on my side?
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Michael,
Thanks it just worked as you said. I tried all different kind of
combinations. I am positive that I tried that one before and it only gave
me an extra page in the beginning instead of at the end. I must have had
something else wrong when I tried that combination.
Thank you very much.
hugh
"Michael Cheng [MSFT]" <v-mingqc@.online.microsoft.com> wrote in message
news:rFgfb314FHA.1144@.TK2MSFTNGXA01.phx.gbl...
> Hi Hugh,
> I understood it wil be a blank page for your
> Please set PageBreakAtStart to be True and set PageBreakAtEnd to be False
> to see whether it could resolve this.
> If above does not work, would you please generate a sample rdl file with
> AdventureWorks for me to reproduce it on my side?
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>

Friday, February 24, 2012

Avoid duplicate index while creating temp table

We are using SQL 2K with sp4.
In our stored procedure, we create a temp table (i.e. #tablename) and
various indexes within the temp table. If mutliple users execute this store
d
procedure at the same time, it would cause duplicate index error. As a
temporary fix, we attach an unique number to the index name. I like to know
what is the best way to solve this problem without extra work?
wingmanI posted a similar query yesterday ( in which I completely mispelled
temporary);
http://groups.google.co.uk/group/mi...b23b0ffd6?hl=en
the basic response was that the indexes can co-exist without naming
conflicts
Cheers
Will|||Wingman,
You can read about this in the BOL. They must be unique within a table or
view but do not need to be unique within a database. Each temporary table
(not global ones ##) is unique. SQL Server create a unique name per user.
AMB
"Wingman" wrote:

> We are using SQL 2K with sp4.
> In our stored procedure, we create a temp table (i.e. #tablename) and
> various indexes within the temp table. If mutliple users execute this sto
red
> procedure at the same time, it would cause duplicate index error. As a
> temporary fix, we attach an unique number to the index name. I like to kn
ow
> what is the best way to solve this problem without extra work?
> wingman|||dude, step back a bit, and think about a solution where you don't have
multipel users accessing the same temp table.
this has GOT to lead to integrity issues.

Sunday, February 19, 2012

AVG for a Column

Hai All,

I have a problem in creating AVG for a Column.
Cos i have a Column ,that is formulated from Division of two other columns Summation
(i.e) SUM(COL1)/SUM(COL2) = COL3
I need to create AVG for COL3
It's not possible to use like this : AVG( SUM(COL1)/SUM(COL2) )
So i used Function to get the Output.
Is there any other way to formulate this work.
Please Enlighten me.
Thanx,
Karthik.A

You could try a derived table:

SELECT AVG(x) AS theAverage
FROM
(
SELECT
SomeCol,
SUM(ColA) / SUM(ColB) AS x
FROM Tbl
GROUP BY SomeCol
) y (SomeCol, x)

|||Hai Adam,
I am already have the data values come from a Stored Procedure.
What i need is,for COL3=AVG(Sum(COL1)/Sum(COL2))
Already some table columns of theStored Procedure are assign to the COL1 and COL2.
Do u need any more explanation.
Thanx,
Karthik.A|||Yes; can you post DDL, some sample data, and the code you're trying to use right now?
See: Etiquette [ASP FAQ]

Thursday, February 16, 2012

Average Turnaround Time - Datediff() Help

Hi everyone, I need some help with creating a report that calculates the average turnaround time in days that it takes for units to return from trips destined to a location.

The database that I am working with lists a trip each time a unit is dispatched to a destination, and then another trip is created for the units return. In the example below I am trying to calculate the number of days that it takes for a unit to return to Vancouver by calculating the difference between the departure date from Vancouver and the arrival date back into Vancouver. I then need to calculate the average number of days that it takes for a unit to return from a trip. See sample data below.

UNIT -- TRIP -- START LOCATION --START DATE--FIN LOCATION--FIN DATE
================================================== =======
U12 --001 -- VANCOUVER ---FEB 10 -- ONTARIO -- FEB 15
U10 --002 -- VANCOUVER ---FEB 13 -- ONTARIO -- FEB 18
U12 --003 -- ONTARIO ----MARCH 13 -- VANCOUVER -- MARCH 18
U10 --004 -- ONTARIO ----MARCH 1 -- VANCOUVER --MARCH 6

Unit U12 took 36 days to return back to Vancouver
Unit U10 took 21 days to return back to Vancouver

Therefore based on the two trips it takes an average of aproximately 28.5 days for a unit to return from trips destined to Ontario.try this, not a greate SQL though :)

select Route, avg(DaysTaken) as AvgDaysTaken
from (
select A.Unit,(select top 1 Start_Location from MyTable where MyTable.Unit=A.Unit order by Trip)+ '-'+(select top 1 Fin_Location from MyTable where MyTable.Unit=A.Unit order by Trip)+'-'+(select top 1 Start_Location from MyTable where MyTable.Unit=A.Unit order by Trip) as Route, cast(A.DaysTaken as decimal(9,2)) as DaysTaken
from (
select Unit,datediff(d,min(Start_date),max(fin_date)) DaysTaken from MyTable group by unit
) A
) B
group by Route