Showing posts with label frequent. Show all posts
Showing posts with label frequent. Show all posts

Sunday, March 25, 2012

(how frequent) in SQL Server?!

I have used Base SAS for analysis for a while and it was really great.. everything is easy just with a simple command.. I am sure it's not the same in SQL Server but I need some help on how to start with the following:

I have a field called call_country and another field called call_minute. Each call will be saved with the destination country and the total number of minutes..

and I want to run a query to see what are the TOP frequent destinations in this format:

United States - Count: 420 - Total Minues: 12,345

It should be easy in SQL too.

SELECT call_country, COUNT(call_minutes) AS tCount, SUM(call_minutes) AS TotalMinutes

FROM calltable

GROUP BY call_country

|||

If you want use the top, you can do this:

--1.based on total minutes

SELECT TOP (1) call_country, COUNT(call_minutes) AS tCount, SUM(call_minutes) AS TotalMinutes

FROM calltable

GROUP BY call_country

ORDER BY TotalMinutes DESC

--2. based on total count

SELECT TOP (1) call_country, COUNT(call_minutes) AS tCount, SUM(call_minutes) AS TotalMinutes

FROM calltable

GROUP BY call_country

ORDER BY tCount DESC

--3.based on total count and use total minutes as tie break.

SELECT TOP (1) call_country, COUNT(call_minutes) AS tCount, SUM(call_minutes) AS TotalMinutes

FROM calltable

GROUP BY call_country

ORDER BY tCount DESC, TotalMinutes DESC

--4.based on total minutes and use total count as tie break.

SELECT TOP (1) call_country, COUNT(call_minutes) AS tCount, SUM(call_minutes) AS TotalMinutes

FROM calltable

GROUP BY call_country

ORDER BY TotalMinutes DESC, tCount DESC

Tuesday, March 6, 2012

"Error in Processing Cubes in Analysis Services"

Hi,

While processing the cube in Analysis server, we are getting frequent error saying

"Analysis Server Error: Connection to the server is lost; Time:2/9/2007 3:56:08 PM
Error(-2147221411): Process operation failed; Time:2/9/2007 3:56:08 PM
Error(-2147221423): Could not open server object (Internal (Database 'PMM' could not be opened on the server));
". help in this regard will be greatly appreciated.

Thanks,

Umesh

Take a look at the log folder that is located under OLAP folder, right next to the bin folder. It is often installed to C:\Program Files\Microsoft SQL Server\MSSQL.2

If you see multiple SQLDump***.mdmp there. And if you see that after any such processing attempt you see new file is created- this is indication of Analysis Server running into situation it cannot recover from, but abort processing operation.

You should install latest service pack for SQL Server 2005 - currently it is SP1.

After, try running unprocess for entire database and then processing all the objects.

If you still see .mdmp files created, contact customer support and show them the repro schenario for the problem you having.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.