Showing posts with label group. Show all posts
Showing posts with label group. Show all posts

Friday, March 30, 2012

Help!!!!--Problems about the multi column report!

I have a 2 coulmns report ,one group ,when I print the report,it does not paging correctly.For example,suppose every column can display 20 rows, if every group has 20-40 rows ,the print is ok,it can paging correctly,but if one group has 10 rows or more than 40 and less than 60,the two groups will print on one paper,how can I print the every group on different paper?

Any advice would be much appreciated.

Thanks.

No one can answer me?|||

Garlic,

You can edit your group properties, On your group, right click, select edit group, on General tab, select "Page break at start" this should give you a new page for each group change.

Monday, March 26, 2012

Help! Set up Windows Group to access application

I am sorry for cross-posting, but I'm used to posting in the programming
section and posted there as a force of habit.
I have an application written in VB6 that is hooked up to Sql Server 2005.
I can't seem to get a regular user to be able to access it. There's a Sql
Server error:
"Login failed for user ''. The user is not associated with a trusted Sql
Server connection." Note that it doesn't name the user; just supplies blank
single quotes together.
I want to use Windows Authentication. I set up a group in Active Directory
called CustomerService.
Can someone show me step by step how I set up the CustomerService group to
access the database MyDatabase?
Any help will be greatly appreciated!!
Sandy> "Login failed for user ''. The user is not associated with a trusted Sql
> Server connection." Note that it doesn't name the user; just supplies
> blank
> single quotes together.
I'm not sure of the significance of the empty string. Most often, the
message specifies user "(NULL)" and that means that the users Windows
credentials could not be verified and may be due to a number of different
reasons. For example, I've seen that happen when the client computer clock
was significantly different that the domain controller.

> Can someone show me step by step how I set up the CustomerService group to
> access the database MyDatabase?
You can grant all members of that AD group access to the database as
follows:
SQL 7 and SQL 2000:
EXEC sp_grantlogin 'MyDomain\CustomerService'
USE MyDatabase
EXEC sp_grantdbaccess 'MyDomain\CustomerService'
SQL 2005:
CREATE LOGIN [MyDomain\CustomerService]
FROM WINDOWS
USE MyDatabase
CREATE USER [MyDomain\CustomerService]
Hope this helps.
Dan Guzman
SQL Server MVP
"Sandy" <Sandy@.discussions.microsoft.com> wrote in message
news:A3D05D3B-79C1-4318-AFE7-E65604A0EFE5@.microsoft.com...
>I am sorry for cross-posting, but I'm used to posting in the programming
> section and posted there as a force of habit.
> I have an application written in VB6 that is hooked up to Sql Server 2005.
> I can't seem to get a regular user to be able to access it. There's a Sql
> Server error:
> "Login failed for user ''. The user is not associated with a trusted Sql
> Server connection." Note that it doesn't name the user; just supplies
> blank
> single quotes together.
> I want to use Windows Authentication. I set up a group in Active
> Directory
> called CustomerService.
> Can someone show me step by step how I set up the CustomerService group to
> access the database MyDatabase?
> Any help will be greatly appreciated!!
> --
> Sandy|||You would execute something like the following:
USE master
GO
CREATE LOGIN [YourDomain\SomeGroup]
FROM WINDOWS
WITH DEFAULT_DATABASE= YourDefaultDatabaseName
GO
USE YourDatabase
GO
CREATE USER [YourDomain\SomeGroup]
FOR LOGIN [YourDomain\SomeGroup]
WITH DEFAULT_SCHEMA= YourDefaultSchemaName
That's just to access the database. Then you need to figure
out permissions in the database.
-Sue
On Mon, 14 May 2007 17:45:01 -0700, Sandy
<Sandy@.discussions.microsoft.com> wrote:

>I am sorry for cross-posting, but I'm used to posting in the programming
>section and posted there as a force of habit.
>I have an application written in VB6 that is hooked up to Sql Server 2005.
>I can't seem to get a regular user to be able to access it. There's a Sql
>Server error:
>"Login failed for user ''. The user is not associated with a trusted Sql
>Server connection." Note that it doesn't name the user; just supplies blan
k
>single quotes together.
>I want to use Windows Authentication. I set up a group in Active Directory
>called CustomerService.
>Can someone show me step by step how I set up the CustomerService group to
>access the database MyDatabase?
>Any help will be greatly appreciated!!|||Thanks for your reply, Sue.
Would I use dbo as YourDefaultSchemaName?
I need all the users in YourDomain/SomeGroup to be able to execute stored
procedures, insert, update and delete on all tables in the database. How
would I word that?
Again, any help is greatly appreciated!
--
Sandy
"Sue Hoegemeier" wrote:

> You would execute something like the following:
> USE master
> GO
> CREATE LOGIN [YourDomain\SomeGroup]
> FROM WINDOWS
> WITH DEFAULT_DATABASE= YourDefaultDatabaseName
> GO
> USE YourDatabase
> GO
> CREATE USER [YourDomain\SomeGroup]
> FOR LOGIN [YourDomain\SomeGroup]
> WITH DEFAULT_SCHEMA= YourDefaultSchemaName
> That's just to access the database. Then you need to figure
> out permissions in the database.
> -Sue
> On Mon, 14 May 2007 17:45:01 -0700, Sandy
> <Sandy@.discussions.microsoft.com> wrote:
>
>

Monday, March 19, 2012

Help! How do you remove a sql group when...

Hi all,
I am attempting to remove a sql server group from my list in enterprise
manager, none of the old registered sql servers in my group exist and the
connections to them times out. How does one get around this problem.
Cheers, LerpCan you not right click on the group in Enterprise Manager and choose
delete to delete the group? You will have to delete the server
registrations first.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Help! How do you remove a sql group when...

Hi all,
I am attempting to remove a sql server group from my list in enterprise
manager, none of the old registered sql servers in my group exist and the
connections to them times out. How does one get around this problem.
Cheers, LerpCan you not right click on the group in Enterprise Manager and choose
delete to delete the group? You will have to delete the server
registrations first.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Help! How do you remove a sql group when...

Hi all,
I am attempting to remove a sql server group from my list in enterprise
manager, none of the old registered sql servers in my group exist and the
connections to them times out. How does one get around this problem.
Cheers, Lerp
Can you not right click on the group in Enterprise Manager and choose
delete to delete the group? You will have to delete the server
registrations first.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Help! How can I get group chronlogical dates

Hi ,

I have the following table

id

SHC

member

start_dt

end_dt

1

100-002-304

LOZANO M.D.,MARTHA E

1/1/2004 0:00

8/22/2004 0:00

2

100-002-304

LOZANO M.D.,MARTHA E

8/23/2004 0:00

9/30/2004 0:00

3

100-002-304

LOZANO M.D.,MARTHA E

10/1/2004 0:00

10/31/2004 0:00

4

100-002-304

WALTER M.D.,SHERI L

4/17/2001 0:00

12/31/2003 0:00

5

100-002-304

WALTER M.D.,SHERI L

1/1/2004 0:00

8/22/2004 0:00

6

100-002-304

WALTER M.D.,SHERI L

8/23/2004 0:00

9/30/2004 0:00

7

100-002-304

WALTER M.D.,SHERI L

10/1/2004 0:00

10/31/2004 0:00

8

100-002-304

WALTER M.D.,SHERI L

11/1/2004 0:00

NULL

9

100-002-304

ZZANTHONY D.O.,JEFFREY

10/1/2000 0:00

4/16/2001 0:00

10

103-259-196

A-OUTSIDE,PCP

12/1/2000 0:00

8/31/2001 0:00

11

103-259-196

A-OUTSIDE,PCP

1/1/2005 0:00

1/1/2005 0:00

12

103-259-196

DILL M.D.,DONALD M

11/1/2000 0:00

11/30/2000 0:00

13

103-259-196

DILL M.D.,DONALD M

9/1/2001 0:00

8/30/2002 0:00

14

103-259-196

DILL M.D.,DONALD M

8/31/2002 0:00

8/31/2002 0:00

15

103-259-196

DILL M.D.,DONALD M

9/1/2002 0:00

10/30/2004 0:00

16

103-259-196

DILL M.D.,DONALD M

10/31/2004 0:00

10/31/2004 0:00

17

103-259-196

DILL M.D.,DONALD M

11/1/2004 0:00

12/30/2004 0:00

18

103-259-196

DILL M.D.,DONALD M

12/31/2004 0:00

12/31/2004 0:00

19

103-259-196

DILL M.D.,DONALD M

1/1/2005 0:00

1/1/2005 0:00

20

103-259-196

DILL M.D.,DONALD M

1/2/2005 0:00

7/30/2005 0:00

21

103-259-196

DILL M.D.,DONALD M

7/31/2005 0:00

7/31/2005 0:00

22

103-259-196

DILL M.D.,DONALD M

10/1/2000 0:00

10/31/2000 0:00

I need to create a query that will return the results like Below

id

SHC

name

start_dt

end_dt

1

100-002-304

LOZANO M.D.,MARTHA E

1/1/2004 0:00

10/31/2004 0:00

4

100-002-304

WALTER M.D.,SHERI L

4/17/2001 0:00

1/1/1900 0:00

9

100-002-304

ZZANTHONY D.O.,JEFFREY

10/1/2000 0:00

4/16/2001 0:00

10

103-259-196

A-OUTSIDE,PCP

12/1/2000 0:00

8/31/2001 0:00

11

103-259-196

A-OUTSIDE,PCP

1/1/2005 0:00

1/1/2005 0:00

22

103-259-196

DILL M.D.,DONALD M

10/1/2000 0:00

11/30/2000 0:00

13

103-259-196

DILL M.D.,DONALD M

9/1/2001 0:00

7/31/2005 0:00

Thanks in Advance

R

Try this query:

Select Min(ID) as ID, Min(SHC) as SHC, Member, Min(Start_dt) as Start_dt, Max(End_dt) as End_dt
From MemberTable
Group By Member

Best regards,
Sami Samir|||select *
from yourtable t
where id = (select top 1 id from yourtable x where x.SHC = t.SHC order by start_dt)|||

Here is a recursive Common Table Expression and SQL which produces the result you want:

WITH MemberList ([ID], SHC, Member, Start_dt, End_dt)
AS (
SELECT [ID], SHC, Member, Start_dt, End_dt
FROM dbo.MemberTable
UNION ALL
SELECT ML.[ID], ML.SHC, ML.Member, ML.Start_dt, MB.End_dt
FROM dbo.MemberTable MB
INNER JOIN MemberList ML
ON (MB.SHC = ML.SHC) AND
(MB.Member = ML.Member) AND
(MB.Start_dt = DATEADD(day, 1, ML.End_dt))
)
SELECT MB.[ID], MB.SHC, [Name] = MB.Member, MB.Start_dt,
CASE
WHEN (ML.End_dt = CAST('31DEC3000' AS DATETIME)) THEN
CAST('1JAN1900' AS DATETIME)
ELSE
ML.End_dt
END
FROM (
SELECT SHC, Member, MIN(Start_dt) AS Start_dt, End_dt
FROM (
SELECT SHC, Member, Start_dt,
MAX(COALESCE(End_dt, CAST('31DEC3000' AS DATETIME))) AS End_dt
FROM MemberList
GROUP BY SHC, Member, Start_dt
) GotEnd
GROUP BY SHC, Member, End_dt
) ML
INNER JOIN dbo.MemberTable MB
ON (MB.SHC = ML.SHC) AND
(MB.Member = ML.Member) AND
(MB.Start_dt =ML.Start_dt)
ORDER BY MB.SHC, MB.Member, MB.Start_dt

I have given the table the name MemberTable as I did not know what name you had used. I think I got all the column names correct from your data.

The CTE itself (yellow background) produces a record set which has a record for each possible chain (starting and ending date with a continuous chain of records (where start = end + 1 day for the same SHC and Member).

The inner query (light blue background) finds the highest/maximum end date for each start date (the nulls are converted to 31 Dec 3000 at this point so they always are considered the last date), by SHC and Member.

The next query out (light grey background) finds the minimum start date for each of the end dates found before (again by SHC and Member). This means we now have the desired list of time spans.

The final outer query simply joins back to the source table to find the correct ID, converts any 31 Dec 3000 dates to 1 Jan 1900 dates, and orders by SHC, Member and Start Date.

There are a couple of assumptions about the source data:

There are no overlaps in time ranges for the same SHC and Member (not sure how this would affect the output).|||

Thanks Samir

but the result is not right. THat is the first thought, but not that easy.,. if you look closely to the results you will see why..

R

|||

Thank you KH

But the result is not right. THat is the first thought, but not that easy.,. if you look closely to the results you will see why..

R

|||

Thank you Dhericean

I think that you are heading on the right direction, but I cannot completely tell you because the script is giving me an error at the WITH clause..

Any idea,,

Thank you in advance..
R

|||

how about something like:

select min(id), SHC, name, min(isnull(start_dt, getdate())), max(isnull(end_dt, getdate()))

from [table name]

group by SHC, name

Is this what you need? Does it need to say 1/1/1900? If it does, how about something like:

select min(id), SHC, name, start_dt, replace(convert(varchar(256), max(isnull(end_dt, getdate()))), convert(varchar(256), getdate(), '1/1/1900')

from [table name]

group by SHC, name

|||

1

100-002-304

LOZANO M.D.,MARTHA E

1/1/2004 0:00

10/31/2004 0:00

4

100-002-304

WALTER M.D.,SHERI L

4/17/2001 0:00

1/1/1900 0:00

9

100-002-304

ZZANTHONY D.O.,JEFFREY

10/1/2000 0:00

4/16/2001 0:00

10

103-259-196

A-OUTSIDE,PCP

12/1/2000 0:00

8/31/2001 0:00

11

103-259-196

A-OUTSIDE,PCP

1/1/2005 0:00

1/1/2005 0:00

22

103-259-196

DILL M.D.,DONALD M

10/1/2000 0:00

11/30/2000 0:00

13

103-259-196

DILL M.D.,DONALD M

9/1/2001 0:00

7/31/2005 0:00


Above is what it should be

below are your results

ID

SHC

MEMBER

START_DT

END_T

10

103-259-196

A-OUTSIDE,PCP

12/1/2000 0:00

1/1/2005 0:00

12

103-259-196

DILL M.D.,DONALD M

10/1/2000 0:00

7/31/2005 0:00

1

100-002-304

LOZANO M.D.,MARTHA E

1/1/2004 0:00

10/31/2004 0:00

4

100-002-304

WALTER M.D.,SHERI L

4/17/2001 0:00

3/19/2007 14:03

9

100-002-304

ZZANTHONY D.O.,JEFFREY

10/1/2000 0:00

4/16/2001 0:00

I wish it was that simple though...Thank you in advance. I really appreciate your help...

|||

Your looking for windows but you are counting a START_DT that is chronologically the next day as an END_DT as being within the same window.

Something like that will need a procedure in t-sql, or some other langauge to figure out.

If you can live with it, just group it by the START_DT...

|||

Possibly,

My co-worker has done using MS Access queries...

I am sure we can do this in SQL,

The objective is to see the the time which member was enrolled continuously.For that, the end dt is start_dt-1 of the next line.

if that is not true than another row would start for the same member..

Thanks

R

|||

Instead of a table like this, please provide the DDL for your table and inserts or we are just going to keep guessing the query without getting your result. Your result expectation is excellent, but it is tedious work to do all of the DDL and DML to build the data ourselves when you have so much.

Thanks!

|||and most importantly PLEASE EXPLAIN THE LOGIC OR HOW THE RESULT IS OBTAIN ? ? ? ?|||

I need to see the error.

I put your data into a table and ran the SQL I gave you against it. The only thing I changed was the table name and a couple of columns (would really suggest not using things like ID (and Value, Name, Member etc.) as column names (avoid reserved words or things that look that they might become reserved words). Here is the complete Repro SQL set (table create, populate, and CTE query).

-- Create the test table
CREATE TABLE [dbo].[CTE_Test](
[Rec_ID] [int] NOT NULL,
[SHC] [nchar](11) COLLATE Latin1_General_CI_AS NOT NULL,
[MemberName] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[DATE_Start] [datetime] NULL,
[DATE_End] [datetime] NULL,
CONSTRAINT [PK_CTE_Test] PRIMARY KEY CLUSTERED
([Rec_ID] ASC)
)

-- Insert the test data
INSERT INTO [dbo].[CTE_Test]
VALUES(1, '100-002-304', 'LOZANO', 'Jan 1 2004', 'Aug 22 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(2, '100-002-304', 'LOZANO', 'Aug 23 2004', 'Sep 30 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(3, '100-002-304', 'LOZANO', 'Oct 1 2004', 'Oct 31 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(4, '100-002-304', 'WALTER', 'Apr 17 2001', 'Dec 31 2003')
INSERT INTO [dbo].[CTE_Test]
VALUES(5, '100-002-304', 'WALTER', 'Jan 1 2004', 'Aug 22 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(6, '100-002-304', 'WALTER', 'Aug 23 2004', 'Sep 30 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(7, '100-002-304', 'WALTER', 'Oct 1 2004', 'Oct 31 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(8, '100-002-304', 'WALTER', 'Nov 1 2004', NULL)
INSERT INTO [dbo].[CTE_Test]
VALUES(9, '100-002-304', 'ZZANTHONY', 'Oct 1 2000', 'Apr 16 2001')
INSERT INTO [dbo].[CTE_Test]
VALUES(10, '103-259-196', 'A-OUTSIDE', 'Dec 1 2000', 'Aug 31 2000')
INSERT INTO [dbo].[CTE_Test]
VALUES(11, '103-259-196', 'A-OUTSIDE', 'Jan 1 2005', 'Jan 1 2005')
INSERT INTO [dbo].[CTE_Test]
VALUES(12, '103-259-196', 'DILL', 'Nov 1 2000', 'Nov 30 2000')
INSERT INTO [dbo].[CTE_Test]
VALUES(13, '103-259-196', 'DILL', 'Sep 1 2001', 'Aug 30 2002')
INSERT INTO [dbo].[CTE_Test]
VALUES(14, '103-259-196', 'DILL', 'Aug 31 2002', 'Aug 31 2002')
INSERT INTO [dbo].[CTE_Test]
VALUES(15, '103-259-196', 'DILL', 'Sep 1 2002', 'Oct 30 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(16, '103-259-196', 'DILL', 'Oct 31 2004', 'Oct 31 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(17, '103-259-196', 'DILL', 'Nov 1 2004', 'Dec 30 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(18, '103-259-196', 'DILL', 'Dec 31 2004', 'Dec 31 2004')
INSERT INTO [dbo].[CTE_Test]
VALUES(19, '103-259-196', 'DILL', 'Jan 1 2005', 'Jan 1 2005')
INSERT INTO [dbo].[CTE_Test]
VALUES(20, '103-259-196', 'DILL', 'Jan 2 2005', 'Jul 30 2005')
INSERT INTO [dbo].[CTE_Test]
VALUES(21, '103-259-196', 'DILL', 'Jul 31 2005', 'Jul 31 2005')
INSERT INTO [dbo].[CTE_Test]
VALUES(22, '103-259-196', 'DILL', 'Oct 1 2000', 'Oct 31 2000')
-- SELECT * FROM CTE_Test ORDER BY Rec_ID

-- The sample CTE query
WITH MemberList (Rec_ID, SHC, MemberName, DATE_Start, DATE_End)
AS (
SELECT Rec_ID, SHC, MemberName, DATE_Start, DATE_End
FROM dbo.CTE_Test
UNION ALL
SELECT ML.Rec_ID, ML.SHC, ML.MemberName, ML.DATE_Start, MB.DATE_End
FROM dbo.CTE_Test MB
INNER JOIN MemberList ML
ON (MB.SHC = ML.SHC) AND
(MB.MemberName = ML.MemberName) AND
(MB.DATE_Start = DATEADD(day, 1, ML.DATE_End))
)
SELECT MB.Rec_ID, MB.SHC, MB.MemberName, MB.DATE_Start,
CASE
WHEN (ML.DATE_End = CAST('31DEC3000' AS DATETIME)) THEN
CAST('1JAN1900' AS DATETIME)
ELSE
ML.DATE_End
END
FROM (
SELECT SHC, MemberName, MIN(DATE_Start) AS DATE_Start, DATE_End
FROM (
SELECT SHC, MemberName, DATE_Start,
MAX(COALESCE(DATE_End, CAST('31DEC3000' AS DATETIME))) AS DATE_End
FROM MemberList
GROUP BY SHC, MemberName, DATE_Start
) GotEnd
GROUP BY SHC, MemberName, DATE_End
) ML
INNER JOIN dbo.CTE_Test MB
ON (MB.SHC = ML.SHC) AND
(MB.MemberName = ML.MemberName) AND
(MB.DATE_Start =ML.DATE_Start)
ORDER BY MB.SHC, MB.MemberName, MB.DATE_Start

This should work as advertised (ran it on my system), and it produced the 7 records you requested. If there are any problem please include any error messages.

This is a basic CTE and could be refined. One example is only including records in the anchor query where there is not another record (for the same SHC, Name) with an EndDate equal to the Start date of the included record +1 day.


Just occurred to me - This functionality will only work if you have SQL Server 2005 as Common Table Expressions are a new feature. If not then it will be a much more complex proposition.


|||

Thank you very much for your reply. I am sure it works. and you are also right about the SQL 2005 script.

I am using SQL 2000...

R

Friday, March 9, 2012

HELP! activation fails CantCommunicateWithReportServerException

Hi
I have read all of the posts in this group (and others!) but still
can't get RS working. I am installing RS on an XP sp2 machine with
VS2003 and SQL2000 sp4. Installation reports activation failed, but
when I check Keys table in ReportServer db there is a row with the
client as 1 and both key binary values.
I have tried rskeymgmt -d, rsactivate -c "path" which generates a new
key, but I still get
" Unable to communicate with report server. Please verify that the
report server is operational. " when I go to
http://localhost/Reports/Pages/Folder.aspx.
And the log file has
aspnet_wp!ui!f80!19/07/2005-09:47:35:: e ERROR: HTTP status code -->
500
--Details--
CantCommunicateWithReportServerException: Unable to communicate with
report server. Please verify that the report server is operational.
at
Microsoft.ReportingServices.UI.RSWebServiceWrapper.GetSecureMethods()
at
Microsoft.SqlServer.ReportingServices.RSConnection.IsSecureMethod(String
methodname)
at Microsoft.ReportingServices.UI.Global.SecureAllAPI()
at
Microsoft.ReportingServices.UI.ReportingPage.EnsureHttpsLevel(HttpsLevel
level)
at
Microsoft.ReportingServices.UI.ReportingPage.ReportingPage_Init(Object
sender, EventArgs args)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain()
aspnet_wp!ui!f80!19/07/2005-09:47:37:: e ERROR: Exception in
ShowErrorPage: System.Threading.ThreadAbortException: Thread was being
aborted.
etc...
I'd be very greatful if someone could assist as I am tearing what's
left of my hair out!Hi
I have found a solution (may not be the only one!).
So, for anyone who is having the same problem...
1. Uninstalled RS
2. I reinstalled the .NET framework (i think this made no difference,
bu who knows)
3. Granted admin rights to ASPNET and IWAM accounts
4. I reinstalled RS, using a domain account rather than the default for
the NT Service
5. replaced the <assemblies> section in the <system.web> section of the
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
Services\ReportServer\web.config file with
<assemblies>
<clear />
<add assembly="ReportingServicesWebServer" />
<add assembly="mscorlib" />
</assemblies>
6. Change the following line in both web.config files
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
Services\ReportServer
and: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
Services\ReportManager
with <trust level="Full" originUrl="" />
And for me, this fixed it. I <i>really</i> hope this fixes it for you,
too. This has been a REAL pain in the you-konw-what. Why Microsoft
can't get the default installation to work out it is on XP and not 2003
and act accordingly is beyond me.
shl wrote:
> Hi
> I have read all of the posts in this group (and others!) but still
> can't get RS working. I am installing RS on an XP sp2 machine with
> VS2003 and SQL2000 sp4. Installation reports activation failed, but
> when I check Keys table in ReportServer db there is a row with the
> client as 1 and both key binary values.
> I have tried rskeymgmt -d, rsactivate -c "path" which generates a new
> key, but I still get
> " Unable to communicate with report server. Please verify that the
> report server is operational. " when I go to
> http://localhost/Reports/Pages/Folder.aspx.
> And the log file has
> aspnet_wp!ui!f80!19/07/2005-09:47:35:: e ERROR: HTTP status code -->
> 500
> --Details--
> CantCommunicateWithReportServerException: Unable to communicate with
> report server. Please verify that the report server is operational.
> at
> Microsoft.ReportingServices.UI.RSWebServiceWrapper.GetSecureMethods()
> at
> Microsoft.SqlServer.ReportingServices.RSConnection.IsSecureMethod(String
> methodname)
> at Microsoft.ReportingServices.UI.Global.SecureAllAPI()
> at
> Microsoft.ReportingServices.UI.ReportingPage.EnsureHttpsLevel(HttpsLevel
> level)
> at
> Microsoft.ReportingServices.UI.ReportingPage.ReportingPage_Init(Object
> sender, EventArgs args)
> at System.EventHandler.Invoke(Object sender, EventArgs e)
> at System.Web.UI.Control.OnInit(EventArgs e)
> at System.Web.UI.Control.InitRecursive(Control namingContainer)
> at System.Web.UI.Page.ProcessRequestMain()
> aspnet_wp!ui!f80!19/07/2005-09:47:37:: e ERROR: Exception in
> ShowErrorPage: System.Threading.ThreadAbortException: Thread was being
> aborted.
> etc...
> I'd be very greatful if someone could assist as I am tearing what's
> left of my hair out!

Wednesday, March 7, 2012

HELP! - SQL Statement does not work!

select d.dname, count(s.staffid) scount
from tstaff s, tdept d
where s.deptid = d.deptid
group by d.dname
having scount > (select avg(count(s.staffid))
from tstaff s
group by s.staffid)
;

can anyone tell me why the above statement does not run. I am getting the following errors:

ERROR at line 5:
ORA-00904: invalid column name

I am trying to get the name of the department and the number of staff who have a higher than average number of staff assigned to that department... any suggestions!?scount is a column alias so you might want to put the actual expression into the HAVING clause

however, there's still a problem

the subquery in the HAVING clause is not scalar, i.e. it can return more than one value

rudy|||Originally posted by r937
scount is a column alias so you might want to put the actual expression into the HAVING clause

however, there's still a problem

the subquery in the HAVING clause is not scalar, i.e. it can return more than one value

rudy

Thanks! I will try that.|||Originally posted by r937
scount is a column alias so you might want to put the actual expression into the HAVING clause

however, there's still a problem

the subquery in the HAVING clause is not scalar, i.e. it can return more than one value

rudy

Hi,

I tried what you suggested but I am still getting problems. Is there an easier way of comparing the number of staff in each department to the overall average across all departments?!

C.|||the error probably wasn't the alias, then -- like i said, your subquery wasn't scalar :)
select d.dname, count(s.staffid) scount
from tstaff s, tdept d
where s.deptid = d.deptid
group by d.dname
having count(s.staffid) >
( select avg(deptcount)
from ( select d.deptid, count(*) as deptcount
from tstaff s, tdept d
where s.deptid = d.deptid
group by d.deptid ) as deptcounts
)
caution: untested|||Originally posted by r937
the error probably wasn't the alias, then -- like i said, your subquery wasn't scalar :)
select d.dname, count(s.staffid) scount
from tstaff s, tdept d
where s.deptid = d.deptid
group by d.dname
having count(s.staffid) >
( select avg(deptcount)
from ( select d.deptid, count(*) as deptcount
from tstaff s, tdept d
where s.deptid = d.deptid
group by d.deptid ) as deptcounts
)
caution: untested

cheers! I will give it a go - thanks a million.

HELP!

Let's say I have a table similar to the one below:
ID Car Color
1 BMW silver
2 BMW silver
3 BMW red
4 BMW red
5 BMW red
Is it possible to group BMW, and count the colors in separate fields.
Car Silver Red
BMW 2 3
"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:9533FD53-A616-438E-BB32-5559CA6B7DDC@.microsoft.com...
> Let's say I have a table similar to the one below:
> ID Car Color
> 1 BMW silver
> 2 BMW silver
> 3 BMW red
> 4 BMW red
> 5 BMW red
> Is it possible to group BMW, and count the colors in separate fields.
> Car Silver Red
> BMW 2 3
If you have a known set of colours, then try
SELECT Car
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'silver' and v.Car = o.Car)
AS Silver
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'red' and v.Car = o.car)
AS Red
FROM vehicles AS o
GROUP BY Car
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.647 / Virus Database: 414 - Release Date: 29/03/2004
|||"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:9533FD53-A616-438E-BB32-5559CA6B7DDC@.microsoft.com...
> Let's say I have a table similar to the one below:
> ID Car Color
> 1 BMW silver
> 2 BMW silver
> 3 BMW red
> 4 BMW red
> 5 BMW red
> Is it possible to group BMW, and count the colors in separate fields.
> Car Silver Red
> BMW 2 3
>
>
>
|||To create crosstabs both static (known number of pivot columns) and
dynamic (unknown number of pivot columns) without any complicated
sql coding check out the RAC utility for S2k.RAC is somewhat similar
to the Access crosstab but is much more powerful and has many
options.
RAC v2.2 and QALite @.
www.rac4sql.net
|||Bob, much thanks to you, the script works perfectly. I did have select within a select as you did, but you took it a step further using V and O. What is V and O by the way? Are they virtual fields?
-- Bob Simms wrote: --
"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:9533FD53-A616-438E-BB32-5559CA6B7DDC@.microsoft.com...
> Let's say I have a table similar to the one below:
> 1 BMW silver
> 2 BMW silver
> 3 BMW red
> 4 BMW red
> 5 BMW red
> BMW 2 3
If you have a known set of colours, then try
SELECT Car
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'silver' and v.Car = o.Car)
AS Silver
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'red' and v.Car = o.car)
AS Red
FROM vehicles AS o
GROUP BY Car
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.647 / Virus Database: 414 - Release Date: 29/03/2004
|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.server:338537
"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:3564FA65-B638-415B-9806-362D5A3C8581@.microsoft.com...
> Bob, much thanks to you, the script works perfectly. I did have select
within a select as you did, but you took it a step further using V and O.
What is V and O by the way? Are they virtual fields?
No, they are just aliases for the tables
FROM vehicles AS v
means that you can then refer to the vehicles table as v
Because we are referring to the vehicles table in the outer and inner SELECT
statements, we have to have give them different aliases so SQL knows which
one we are talking about.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004

Monday, February 27, 2012

HELP!

Let's say I have a table similar to the one below:
ID Car Color
1 BMW silver
2 BMW silver
3 BMW red
4 BMW red
5 BMW red
Is it possible to group BMW, and count the colors in separate fields.
Car Silver Red
BMW 2 3"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:9533FD53-A616-438E-BB32-5559CA6B7DDC@.microsoft.com...
> Let's say I have a table similar to the one below:
> ID Car Color
> 1 BMW silver
> 2 BMW silver
> 3 BMW red
> 4 BMW red
> 5 BMW red
> Is it possible to group BMW, and count the colors in separate fields.
> Car Silver Red
> BMW 2 3
If you have a known set of colours, then try
SELECT Car
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'silver' and v.Car = o.Car)
AS Silver
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'red' and v.Car = o.car)
AS Red
FROM vehicles AS o
GROUP BY Car
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.647 / Virus Database: 414 - Release Date: 29/03/2004|||"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:9533FD53-A616-438E-BB32-5559CA6B7DDC@.microsoft.com...
> Let's say I have a table similar to the one below:
> ID Car Color
> 1 BMW silver
> 2 BMW silver
> 3 BMW red
> 4 BMW red
> 5 BMW red
> Is it possible to group BMW, and count the colors in separate fields.
> Car Silver Red
> BMW 2 3
>
>
>|||To create crosstabs both static (known number of pivot columns) and
dynamic (unknown number of pivot columns) without any complicated
sql coding check out the RAC utility for S2k.RAC is somewhat similar
to the Access crosstab but is much more powerful and has many
options.
RAC v2.2 and QALite @.
www.rac4sql.net|||Bob, much thanks to you, the script works perfectly. I did have select with
in a select as you did, but you took it a step further using V and O. What i
s V and O by the way? Are they virtual fields?
-- Bob Simms wrote: --
"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:9533FD53-A616-438E-BB32-5559CA6B7DDC@.microsoft.com...
> Let's say I have a table similar to the one below:
> 1 BMW silver
> 2 BMW silver
> 3 BMW red
> 4 BMW red
> 5 BMW red
> BMW 2 3
If you have a known set of colours, then try
SELECT Car
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'silver' and v.Car = o.Car)
AS Silver
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'red' and v.Car = o.car)
AS Red
FROM vehicles AS o
GROUP BY Car
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.647 / Virus Database: 414 - Release Date: 29/03/2004|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.server:338537
"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:3564FA65-B638-415B-9806-362D5A3C8581@.microsoft.com...
> Bob, much thanks to you, the script works perfectly. I did have select
within a select as you did, but you took it a step further using V and O.
What is V and O by the way? Are they virtual fields?
No, they are just aliases for the tables
FROM vehicles AS v
means that you can then refer to the vehicles table as v
Because we are referring to the vehicles table in the outer and inner SELECT
statements, we have to have give them different aliases so SQL knows which
one we are talking about.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004

HELP!

Let's say I have a table similar to the one below
ID Car Colo
1 BMW silve
2 BMW silve
3 BMW red
4 BMW re
5 BMW re
Is it possible to group BMW, and count the colors in separate fields
Car Silver Re
BMW 2"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:9533FD53-A616-438E-BB32-5559CA6B7DDC@.microsoft.com...
> Let's say I have a table similar to the one below:
> ID Car Color
> 1 BMW silver
> 2 BMW silver
> 3 BMW red
> 4 BMW red
> 5 BMW red
> Is it possible to group BMW, and count the colors in separate fields.
> Car Silver Red
> BMW 2 3
If you have a known set of colours, then try
SELECT Car
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'silver' and v.Car = o.Car)
AS Silver
, (SELECT COUNT(*)
FROM vehicles AS v
WHERE Colour = 'red' and v.Car = o.car)
AS Red
FROM vehicles AS o
GROUP BY Car
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.647 / Virus Database: 414 - Release Date: 29/03/2004|||"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:9533FD53-A616-438E-BB32-5559CA6B7DDC@.microsoft.com...
> Let's say I have a table similar to the one below:
> ID Car Color
> 1 BMW silver
> 2 BMW silver
> 3 BMW red
> 4 BMW red
> 5 BMW red
> Is it possible to group BMW, and count the colors in separate fields.
> Car Silver Red
> BMW 2 3
>
>
>|||To create crosstabs both static (known number of pivot columns) and
dynamic (unknown number of pivot columns) without any complicated
sql coding check out the RAC utility for S2k.RAC is somewhat similar
to the Access crosstab but is much more powerful and has many
options.
RAC v2.2 and QALite @.
www.rac4sql.net|||"Chambers" <anonymous@.discussions.microsoft.com> wrote in message
news:3564FA65-B638-415B-9806-362D5A3C8581@.microsoft.com...
> Bob, much thanks to you, the script works perfectly. I did have select
within a select as you did, but you took it a step further using V and O.
What is V and O by the way? Are they virtual fields?
No, they are just aliases for the tables
FROM vehicles AS v
means that you can then refer to the vehicles table as v
Because we are referring to the vehicles table in the outer and inner SELECT
statements, we have to have give them different aliases so SQL knows which
one we are talking about.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004