Showing posts with label management. Show all posts
Showing posts with label management. Show all posts

Friday, March 9, 2012

Get the Grand Total of this query

I need to get the Grand Total of the results of this query.
The query pulls the total customer quotes for each community in a management company and loads my DataGrid:

This query works fine for individual community totals

"SELECT TOP 100 PERCENT vcName, COUNT(DISTINCT vcCustId) AS " & _
" Total FROM dbo.PropReportData WHERE cManagementCo = '" & Session("MgmtCo") & "' and " & _
" (vcEntryDate >= CONVERT(DATETIME, '" & StartDate & "', 102)) AND " & _
"(vcEntryDate <= CONVERT(DATETIME, '" & EndDate & " 11:59:59 PM" & "' , 102))GROUP BY vcName ORDER by vcName"

At first glance you would think that the following query would return the Grand Total for all communities in the management company:

Current Grand Total Query

"SELECT COUNT(DISTINCT vcCustID) As gTotal FROM PropReportData WHERE
cManagementCo = '" & Session("MgmtCo") & "' AND vcEntryDate >= '" & Session
("StartDate") & "' AND vcEntryDate <= '" & Session("EndDate") & " 11:59:59 PM' "

But here's the problem. If there are multiple customer quotes created for different communites, then the customer(vcCustID) is only counted once in the Grand Total Query because I have to use DISTINCT, which of course only picks up one instance of the customer.

Thanks in advance.The simple answer is to not use DISTINCT. Why is it that you "have" to use that keyword in your grand total query?

Terri|||In my application not using DISTINCT is not an option right now. I plan on changing a lot about this piece, but the president is breathing down my neck so I had to get it working post haste.

The reason for DISTINCT is there are multiple quote lines for a given cust Id. I did end up making it work however. I had to count phone and email in individual arrays and then combine the totals. The problem being that if a cust contacted us by both Email and Phone, the Grand Total query only pick them up based off the last quote entry, of course that is because of using distinct. So it did not match the totals that we report on, which are Phone and Email.

Thanks.

Sunday, February 19, 2012

get my hands wet with the SQL 2005 mgmt studio

We are still working with SQL 2000, but I like to manage my 2000 boxes using
the SQL 2005 client tools primarily Management Studio.
I know I can do so. Can you tell me if anything might break ?
Also is it possible to have side by side installations of EM and SQL 2K5 MS
? Last time i installed it side by side , my EM didnt work
Let me know .
Yes, you can use Management Studio to administer SQL Server 2000 instances.
Of course, some features (like Database Mail) will not be available on these
servers.
I have both SQL Server 2000 and 2005 running perfectly on my laptop. So I
have Enterprise Manager and the new Management Studio working on the same
computer with no problem.
Hope this helps,
Ben Nevarez
MCDBA, OCP
"Hassan" <hassan@.hotmail.com> wrote in message
news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> We are still working with SQL 2000, but I like to manage my 2000 boxes
> using the SQL 2005 client tools primarily Management Studio.
> I know I can do so. Can you tell me if anything might break ?
> Also is it possible to have side by side installations of EM and SQL 2K5
> MS ? Last time i installed it side by side , my EM didnt work
> Let me know .
>
|||I removed the enterprise manager from sql 2000 and use only the new MS from
2005 to administer both our corporate SQL servers ( 2000 , 2005 )
it works perfect and i am surprise how easy this worked out for me ( i even
have the idea that my DTS tasks are faster with the new provider to my old
server )
regards
Michel Posseth [MCP]
"Hassan" <hassan@.hotmail.com> wrote in message
news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> We are still working with SQL 2000, but I like to manage my 2000 boxes
> using the SQL 2005 client tools primarily Management Studio.
> I know I can do so. Can you tell me if anything might break ?
> Also is it possible to have side by side installations of EM and SQL 2K5
> MS ? Last time i installed it side by side , my EM didnt work
> Let me know .
>
|||Something interesting, one database in one of my SQL 2000 servers is in
'Database compatibility level 65' and looks like it is not supported by
Management Studio. MS shows DatabaseName (6.5 Compatible) but all the
database functions and object browsing are disabled.
Ben Nevarez, MCDBA, OCP
Database Administrator
"m.posseth" wrote:

> I removed the enterprise manager from sql 2000 and use only the new MS from
> 2005 to administer both our corporate SQL servers ( 2000 , 2005 )
> it works perfect and i am surprise how easy this worked out for me ( i even
> have the idea that my DTS tasks are faster with the new provider to my old
> server )
> regards
> Michel Posseth [MCP]
>
> "Hassan" <hassan@.hotmail.com> wrote in message
> news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
>
>

get my hands wet with the SQL 2005 mgmt studio

We are still working with SQL 2000, but I like to manage my 2000 boxes using
the SQL 2005 client tools primarily Management Studio.
I know I can do so. Can you tell me if anything might break ?
Also is it possible to have side by side installations of EM and SQL 2K5 MS
? Last time i installed it side by side , my EM didnt work
Let me know .Yes, you can use Management Studio to administer SQL Server 2000 instances.
Of course, some features (like Database Mail) will not be available on these
servers.
I have both SQL Server 2000 and 2005 running perfectly on my laptop. So I
have Enterprise Manager and the new Management Studio working on the same
computer with no problem.
Hope this helps,
Ben Nevarez
MCDBA, OCP
"Hassan" <hassan@.hotmail.com> wrote in message
news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> We are still working with SQL 2000, but I like to manage my 2000 boxes
> using the SQL 2005 client tools primarily Management Studio.
> I know I can do so. Can you tell me if anything might break ?
> Also is it possible to have side by side installations of EM and SQL 2K5
> MS ? Last time i installed it side by side , my EM didnt work
> Let me know .
>|||I removed the enterprise manager from sql 2000 and use only the new MS from
2005 to administer both our corporate SQL servers ( 2000 , 2005 )
it works perfect and i am surprise how easy this worked out for me ( i even
have the idea that my DTS tasks are faster with the new provider to my old
server )
regards
Michel Posseth [MCP]
"Hassan" <hassan@.hotmail.com> wrote in message
news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> We are still working with SQL 2000, but I like to manage my 2000 boxes
> using the SQL 2005 client tools primarily Management Studio.
> I know I can do so. Can you tell me if anything might break ?
> Also is it possible to have side by side installations of EM and SQL 2K5
> MS ? Last time i installed it side by side , my EM didnt work
> Let me know .
>|||Something interesting, one database in one of my SQL 2000 servers is in
'Database compatibility level 65' and looks like it is not supported by
Management Studio. MS shows DatabaseName (6.5 Compatible) but all the
database functions and object browsing are disabled.
Ben Nevarez, MCDBA, OCP
Database Administrator
"m.posseth" wrote:

> I removed the enterprise manager from sql 2000 and use only the new MS fro
m
> 2005 to administer both our corporate SQL servers ( 2000 , 2005 )
> it works perfect and i am surprise how easy this worked out for me ( i eve
n
> have the idea that my DTS tasks are faster with the new provider to my old
> server )
> regards
> Michel Posseth [MCP]
>
> "Hassan" <hassan@.hotmail.com> wrote in message
> news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
>
>

get my hands wet with the SQL 2005 mgmt studio

We are still working with SQL 2000, but I like to manage my 2000 boxes using
the SQL 2005 client tools primarily Management Studio.
I know I can do so. Can you tell me if anything might break ?
Also is it possible to have side by side installations of EM and SQL 2K5 MS
? Last time i installed it side by side , my EM didnt work
Let me know .Yes, you can use Management Studio to administer SQL Server 2000 instances.
Of course, some features (like Database Mail) will not be available on these
servers.
I have both SQL Server 2000 and 2005 running perfectly on my laptop. So I
have Enterprise Manager and the new Management Studio working on the same
computer with no problem.
Hope this helps,
Ben Nevarez
MCDBA, OCP
"Hassan" <hassan@.hotmail.com> wrote in message
news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> We are still working with SQL 2000, but I like to manage my 2000 boxes
> using the SQL 2005 client tools primarily Management Studio.
> I know I can do so. Can you tell me if anything might break ?
> Also is it possible to have side by side installations of EM and SQL 2K5
> MS ? Last time i installed it side by side , my EM didnt work
> Let me know .
>|||I removed the enterprise manager from sql 2000 and use only the new MS from
2005 to administer both our corporate SQL servers ( 2000 , 2005 )
it works perfect and i am surprise how easy this worked out for me ( i even
have the idea that my DTS tasks are faster with the new provider to my old
server )
regards
Michel Posseth [MCP]
"Hassan" <hassan@.hotmail.com> wrote in message
news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> We are still working with SQL 2000, but I like to manage my 2000 boxes
> using the SQL 2005 client tools primarily Management Studio.
> I know I can do so. Can you tell me if anything might break ?
> Also is it possible to have side by side installations of EM and SQL 2K5
> MS ? Last time i installed it side by side , my EM didnt work
> Let me know .
>|||Something interesting, one database in one of my SQL 2000 servers is in
'Database compatibility level 65' and looks like it is not supported by
Management Studio. MS shows DatabaseName (6.5 Compatible) but all the
database functions and object browsing are disabled.
Ben Nevarez, MCDBA, OCP
Database Administrator
"m.posseth" wrote:
> I removed the enterprise manager from sql 2000 and use only the new MS from
> 2005 to administer both our corporate SQL servers ( 2000 , 2005 )
> it works perfect and i am surprise how easy this worked out for me ( i even
> have the idea that my DTS tasks are faster with the new provider to my old
> server )
> regards
> Michel Posseth [MCP]
>
> "Hassan" <hassan@.hotmail.com> wrote in message
> news:ehsiHOk8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> > We are still working with SQL 2000, but I like to manage my 2000 boxes
> > using the SQL 2005 client tools primarily Management Studio.
> >
> > I know I can do so. Can you tell me if anything might break ?
> >
> > Also is it possible to have side by side installations of EM and SQL 2K5
> > MS ? Last time i installed it side by side , my EM didnt work
> >
> > Let me know .
> >
>
>