SQL Query with a little bit more complicated WHERE clause performance issue

Hello, I have some performance issue in this case:
Very simplified query:
SELECT COUNT(*) FROM Items
WHERE
ConditionA OR
ConditionB OR
ConditionC OR ...
Simply I have to determine how many Items the user has access through some complicated conditions.
When there is a large number of records (100,000+) in the Items table and say ~10 complicated conditions concatenated in WHERE clause, I get the result about 2 seconds in my case. The problem is when very few conditions are met, f.e. when I get only
10 Items from 100,000.
How can I improve the performace in this "Get my items" case?
Additional information:
the query is generated by EF 6.1
MS SQL 2012 Express
Here is the main part of the real SQL Execution Plan:

Can you post table/index DDL?  Query?
Sample query:
exec sp_executesql N'SELECT
[GroupBy1].[A1] AS [C1]
FROM ( SELECT
COUNT(1) AS [A1]
FROM [dbo].[Tickets] AS [Extent1]
LEFT OUTER JOIN [dbo].[Services] AS [Extent2] ON [Extent1].[ServiceId] = [Extent2].[Id]
WHERE (@p__linq__0 = 1) OR ([Extent1].[SubmitterKey] = @p__linq__1) OR ([Extent1].[OperatorKey] = @p__linq__2) OR (([Extent1].[OperatorKey] IS NULL) AND (@p__linq__2 IS NULL)) OR ([Extent1].[SolverKey] = @p__linq__3) OR (([Extent1].[SolverKey] IS NULL) AND (@p__linq__3 IS NULL)) OR ([Extent1].[Incident2ndLineSupportKey] = @p__linq__4) OR (([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (@p__linq__4 IS NULL)) OR ((@p__linq__5 = 1) AND ((1 = CAST( [Extent1].[TicketType] AS int)) OR ((@p__linq__6 = 1) AND (((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[IncidentManager] = @p__linq__7) OR (([Extent2].[IncidentManager] IS NULL) AND (@p__linq__7 IS NULL)))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ServiceRequestManager] = @p__linq__8) OR (([Extent2].[ServiceRequestManager] IS NULL) AND (@p__linq__8 IS NULL)))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ProblemManager] = @p__linq__9) OR (([Extent2].[ProblemManager] IS NULL) AND (@p__linq__9 IS NULL)))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ChangeManager] = @p__linq__10) OR (([Extent2].[ChangeManager] IS NULL) AND (@p__linq__10 IS NULL)))))) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceDeputyManagers] AS [Extent3]
WHERE ([Extent1].[ServiceId] = [Extent3].[ServiceId]) AND ( CAST( [Extent3].[TicketType] AS int) = CAST( [Extent1].[TicketType] AS int)) AND ([Extent3].[UserProviderKey] = @p__linq__11)
)))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[Incident1stLineSupportLimitedAccess] <> cast(1 as bit))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ServiceRequestLimitedAccess] <> cast(1 as bit))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND ([Extent2].[ProblemLimitedAccess] <> cast(1 as bit))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ChangeLimitedAccess] <> cast(1 as bit))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent4]
WHERE ([Extent1].[ServiceId] = [Extent4].[ServiceId]) AND (2 = CAST( [Extent4].[TicketType] AS int)) AND ([Extent4].[UserProviderKey] = @p__linq__12) AND (1 = [Extent4].[SupportLine])
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent5]
WHERE ([Extent5].[UserProviderKey] = @p__linq__13) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent6]
WHERE ([Extent6].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent6].[TicketType] AS int)) AND (1 = [Extent6].[SupportLine]) AND ([Extent6].[OperatorGroupId] = [Extent5].[OperatorGroupId])
)))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent1].[IncidentFunctionEscalatedTo2ndLineSupport] = 1) AND ([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (([Extent2].[Incident2ndLineSupportLimitedAccess] <> cast(1 as bit)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent7]
WHERE ([Extent1].[ServiceId] = [Extent7].[ServiceId]) AND (2 = CAST( [Extent7].[TicketType] AS int)) AND ([Extent7].[UserProviderKey] = @p__linq__14) AND (2 = [Extent7].[SupportLine])
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent8]
WHERE ([Extent8].[UserProviderKey] = @p__linq__15) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent9]
WHERE ([Extent9].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent9].[TicketType] AS int)) AND (2 = [Extent9].[SupportLine]) AND ([Extent9].[OperatorGroupId] = [Extent8].[OperatorGroupId])
)))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = CAST( [Extent1].[TicketState] AS int)) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent10]
WHERE ([Extent1].[ServiceId] = [Extent10].[ServiceId]) AND (3 = CAST( [Extent10].[TicketType] AS int)) AND ([Extent10].[UserProviderKey] = @p__linq__16)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent11]
WHERE ([Extent11].[UserProviderKey] = @p__linq__17) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent12]
WHERE ([Extent12].[ServiceId] = [Extent1].[ServiceId]) AND (3 = CAST( [Extent12].[TicketType] AS int)) AND ([Extent12].[OperatorGroupId] = [Extent11].[OperatorGroupId])
)))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent13]
WHERE ([Extent1].[ServiceId] = [Extent13].[ServiceId]) AND (4 = CAST( [Extent13].[TicketType] AS int)) AND ([Extent13].[UserProviderKey] = @p__linq__18)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent14]
WHERE ([Extent14].[UserProviderKey] = @p__linq__19) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent15]
WHERE ([Extent15].[ServiceId] = [Extent1].[ServiceId]) AND (4 = CAST( [Extent15].[TicketType] AS int)) AND ([Extent15].[OperatorGroupId] = [Extent14].[OperatorGroupId])
)))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent16]
WHERE ([Extent1].[ServiceId] = [Extent16].[ServiceId]) AND (5 = CAST( [Extent16].[TicketType] AS int)) AND ([Extent16].[UserProviderKey] = @p__linq__20)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent17]
WHERE ([Extent17].[UserProviderKey] = @p__linq__21) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent18]
WHERE ([Extent18].[ServiceId] = [Extent1].[ServiceId]) AND (5 = CAST( [Extent18].[TicketType] AS int)) AND ([Extent18].[OperatorGroupId] = [Extent17].[OperatorGroupId])
)))) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[TicketInvitations] AS [Extent19]
WHERE ([Extent19].[TicketId] = [Extent1].[Id]) AND (([Extent19].[InvitedUserProviderKey] = @p__linq__22) OR (([Extent19].[InvitedUserProviderKey] IS NULL) AND (@p__linq__22 IS NULL)))
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM (SELECT
[Extent20].[CustomerId] AS [CustomerId]
FROM [dbo].[CustomerUsers] AS [Extent20]
WHERE ([Extent20].[UserProviderKey] = @p__linq__23) AND ([Extent20].[CanAccessOthersTickets] = 1)
INTERSECT
SELECT
[Extent21].[CustomerId] AS [CustomerId]
FROM [dbo].[CustomerUsers] AS [Extent21]
WHERE [Extent21].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect1]
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM (SELECT
[Extent22].[InternalGroupId] AS [InternalGroupId]
FROM [dbo].[InternalGroupUsers] AS [Extent22]
WHERE ([Extent22].[UserProviderKey] = @p__linq__24) AND ([Extent22].[CanAccessOthersTickets] = 1)
INTERSECT
SELECT
[Extent23].[InternalGroupId] AS [InternalGroupId]
FROM [dbo].[InternalGroupUsers] AS [Extent23]
WHERE [Extent23].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect2]
) AS [GroupBy1]',N'@p__linq__0 bit,@p__linq__1 varchar(8000),@p__linq__2 varchar(8000),@p__linq__3 varchar(8000),@p__linq__4 varchar(8000),@p__linq__5 bit,@p__linq__6 bit,@p__linq__7 varchar(8000),@p__linq__8 varchar(8000),@p__linq__9 varchar(8000),@p__linq__10 varchar(8000),@p__linq__11 varchar(8000),@p__linq__12 varchar(8000),@p__linq__13 varchar(8000),@p__linq__14 varchar(8000),@p__linq__15 varchar(8000),@p__linq__16 varchar(8000),@p__linq__17 varchar(8000),@p__linq__18 varchar(8000),@p__linq__19 varchar(8000),@p__linq__20 varchar(8000),@p__linq__21 varchar(8000),@p__linq__22 varchar(8000),@p__linq__23 varchar(8000),@p__linq__24 varchar(8000)',@p__linq__0=0,@p__linq__1='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__2='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__3='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__4='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__5=1,@p__linq__6=0,@p__linq__7='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__8='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__9='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__10='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__11='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__12='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__13='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__14='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__15='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__16='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__17='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__18='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__19='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__20='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__21='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__22='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__23='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__24='31555851-b89d-4a15-bb05-5a6fd42f9552'
Generated DDL for related tables: (indexes are primary on PKs and FKs)
CREATE TABLE [dbo].[CustomerUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[CustomerId] [int] NOT NULL,
[CanAccessOthersTickets] [bit] NOT NULL,
CONSTRAINT [PK_dbo.CustomerUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[InternalGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[InternalGroupUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[InternalGroupId] [int] NOT NULL,
[CanAccessOthersTickets] [bit] NOT NULL,
CONSTRAINT [PK_dbo.InternalGroupUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[InternalGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[OperatorGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[OperatorGroupUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[OperatorGroupId] [int] NOT NULL,
CONSTRAINT [PK_dbo.OperatorGroupUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[ServiceDeputyManagers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ServiceDeputyManagers](
[UserProviderKey] [varchar](184) NOT NULL,
[ServiceId] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceDeputyManagers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[ServiceId] ASC,
[TicketType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[ServiceOperatorGroups] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceOperatorGroups](
[ServiceId] [int] NOT NULL,
[OperatorGroupId] [int] NOT NULL,
[TicketTypeValue] [int] NOT NULL,
[SupportLine] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceOperatorGroups] PRIMARY KEY CLUSTERED
[ServiceId] ASC,
[OperatorGroupId] ASC,
[TicketTypeValue] ASC,
[SupportLine] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[ServiceOperators] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ServiceOperators](
[UserProviderKey] [varchar](184) NOT NULL,
[ServiceId] [int] NOT NULL,
[TicketTypeValue] [int] NOT NULL,
[SupportLine] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceOperators] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[ServiceId] ASC,
[TicketTypeValue] ASC,
[SupportLine] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Services] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Services](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ParentId] [int] NULL,
[Name] [nvarchar](256) NOT NULL,
[Description] [nvarchar](max) NULL,
[Disabled] [bit] NOT NULL,
[NewTicketLimitedAccess] [bit] NOT NULL,
[Incident1stLineSupportLimitedAccess] [bit] NOT NULL,
[Incident2ndLineSupportLimitedAccess] [bit] NOT NULL,
[ServiceRequestLimitedAccess] [bit] NOT NULL,
[ProblemLimitedAccess] [bit] NOT NULL,
[ServiceRequestManager] [varchar](184) NOT NULL,
[IncidentManager] [varchar](184) NOT NULL,
[ProblemManager] [varchar](184) NOT NULL,
[Deleted] [bit] NOT NULL,
[WfDisableIncidentAssignedState] [bit] NOT NULL,
[WfDisableIncidentConfirmedState] [bit] NOT NULL,
[WfDisableIncidentTakeFromQueueAction] [bit] NOT NULL,
[WfDisableIncidentFinishSolutionAction] [bit] NOT NULL,
[WfDisableServiceRequestAssignedState] [bit] NOT NULL,
[WfDisableServiceRequestConfirmedState] [bit] NOT NULL,
[WfDisableServiceRequestTakeFromQueueAction] [bit] NOT NULL,
[WfDisableServiceRequestFinishSolutionAction] [bit] NOT NULL,
[WfDisableServiceRequestPostponeAction] [bit] NOT NULL,
[ChangeLimitedAccess] [bit] NOT NULL,
[ChangeManager] [varchar](184) NOT NULL,
[WfDisableChangeTakeFromQueueAction] [bit] NOT NULL,
[WfDisableChangeAssignedState] [bit] NOT NULL,
[WfDisableChangeStartPreparationAction] [bit] NOT NULL,
[IsDepartment] [bit] NOT NULL,
[InheritsFromDepartment] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForIncidents] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForServiceRequests] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForProblems] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForChanges] [bit] NOT NULL,
[AllowAccessToOtherOperatorsIncidents] [bit] NOT NULL,
[AllowAccessToOtherOperatorsServiceRequests] [bit] NOT NULL,
[AllowAccessToOtherOperatorsProblems] [bit] NOT NULL,
[AllowAccessToOtherOperatorsChanges] [bit] NOT NULL,
[AllowChangeDeadlineForIncidents] [bit] NOT NULL,
[AllowChangeDeadlineForServiceRequests] [bit] NOT NULL,
[AllowChangeDeadlineForProblems] [bit] NOT NULL,
[AllowChangeDeadlineForChanges] [bit] NOT NULL,
[AllowSelectPriorityForServiceRequests] [bit] NOT NULL,
[WfDisableIncidentCompletedState] [bit] NOT NULL,
[WfDoIncidentCompleteActionBySubmittersMessage] [bit] NOT NULL,
[WfDisableServiceRequestCompletedState] [bit] NOT NULL,
[WfDoServiceRequestCompleteActionBySubmittersMessage] [bit] NOT NULL,
CONSTRAINT [PK_dbo.Services] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[TicketInvitations] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TicketInvitations](
[Id] [int] IDENTITY(1,1) NOT NULL,
[TicketId] [int] NOT NULL,
[InitiatorUserProviderKey] [varchar](184) NULL,
[InitiatorFullName] [nvarchar](max) NULL,
[InvitedUserProviderKey] [varchar](184) NULL,
[InvitedFullName] [nvarchar](max) NULL,
[Type] [int] NOT NULL,
[CreatedUTC] [datetime] NOT NULL,
CONSTRAINT [PK_dbo.TicketInvitations] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Tickets] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Tickets](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ParentId] [int] NULL,
[ServiceId] [int] NULL,
[ServiceMailboxId] [int] NULL,
[TicketTypeValue] [int] NOT NULL,
[TicketTypeIdREF] [int] NOT NULL,
[SubmitterKey] [varchar](184) NOT NULL,
[SubmitterFullName] [nvarchar](256) NULL,
[CustomerId] [int] NULL,
[SolverKey] [varchar](184) NULL,
[SolverFullName] [nvarchar](256) NULL,
[Subject] [nvarchar](max) NULL,
[CreatedUTC] [datetime] NOT NULL,
[Archived] [bit] NOT NULL,
[MarkedAsSolvedUTC] [datetime] NULL,
[ArchivedUTC] [datetime] NULL,
[TicketSourceValue] [int] NOT NULL,
[OperatorKey] [varchar](184) NULL,
[DeadlineUTC] [datetime] NULL,
[DeadlineLastNotificatedPercentage] [int] NULL,
[UrgencyValue] [int] NULL,
[ImpactValue] [int] NULL,
[PriorityValue] [int] NULL,
[TicketStateValue] [int] NOT NULL,
[IncidentFunctionEscalatedTo2ndLineSupport] [bit] NOT NULL,
[Incident2ndLineSupportKey] [varchar](184) NULL,
[Incident2ndLineSupportFullName] [nvarchar](max) NULL,
[TicketType] [int] NOT NULL,
[Source] [int] NOT NULL,
[TicketState] [int] NOT NULL,
[Urgency] [int] NULL,
[Impact] [int] NULL,
[TicketSummaryState] [int] NOT NULL,
[ResolutionText] [nvarchar](max) NULL,
[ResolutionModifiedUTC] [datetime] NULL,
[ResolutionEdited] [bit] NOT NULL,
[ResolutionUserProviderKey] [varchar](184) NULL,
[ResolutionFullName] [nvarchar](max) NULL,
[TicketSubType] [int] NULL,
[ChangeRiskProbabilityValue] [int] NULL,
[ChangeImpactValue] [int] NULL,
[ChangeRiskCategoryValue] [int] NULL,
[RfcText] [nvarchar](max) NULL,
[RfcModifiedUTC] [datetime] NULL,
[RfcEdited] [bit] NOT NULL,
[RfcUserProviderKey] [varchar](184) NULL,
[RfcFullName] [nvarchar](max) NULL,
[ManualDeadline] [bit] NOT NULL,
[ContactInformation] [nvarchar](256) NULL,
[Imported] [bit] NOT NULL,
[ForceClosed] [bit] NOT NULL,
CONSTRAINT [PK_dbo.Tickets] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[CustomerUsers]
[CustomerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_InternalGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_InternalGroupId] ON [dbo].[InternalGroupUsers]
[InternalGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[OperatorGroupUsers]
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceDeputyManagers]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[ServiceOperatorGroups]
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperatorGroups]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperators]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Services]
[ParentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_TicketId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_TicketId] ON [dbo].[TicketInvitations]
[TicketId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_TicketInvitations_InvitedUserProviderKey_TicketId] Script Date: 7.5.2014 8:39:38 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_TicketInvitations_InvitedUserProviderKey_TicketId] ON [dbo].[TicketInvitations]
[InvitedUserProviderKey] ASC,
[TicketId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[Tickets]
[CustomerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Tickets]
[ParentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[Tickets]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceMailboxId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceMailboxId] ON [dbo].[Tickets]
[ServiceMailboxId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SolverFullName] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SolverFullName] ON [dbo].[Tickets]
[SolverFullName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SolverKey] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SolverKey] ON [dbo].[Tickets]
[SolverKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SubmitterFullName] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SubmitterFullName] ON [dbo].[Tickets]
[SubmitterFullName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SubmitterKey] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SubmitterKey] ON [dbo].[Tickets]
[SubmitterKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_Tickets_TicketType_TicketTypeIdREF] Script Date: 7.5.2014 8:39:38 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Tickets_TicketType_TicketTypeIdREF] ON [dbo].[Tickets]
[TicketType] ASC,
[TicketTypeIdREF] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customers] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CustomerUsers] CHECK CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId]
GO
ALTER TABLE [dbo].[InternalGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId] FOREIGN KEY([InternalGroupId])
REFERENCES [dbo].[InternalGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[InternalGroupUsers] CHECK CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId]
GO
ALTER TABLE [dbo].[OperatorGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
REFERENCES [dbo].[OperatorGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OperatorGroupUsers] CHECK CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId]
GO
ALTER TABLE [dbo].[ServiceDeputyManagers] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceDeputyManagers] CHECK CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
REFERENCES [dbo].[OperatorGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId]
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[ServiceOperators] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperators] CHECK CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[Services] WITH CHECK ADD CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId] FOREIGN KEY([ParentId])
REFERENCES [dbo].[Services] ([Id])
GO
ALTER TABLE [dbo].[Services] CHECK CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId]
GO
ALTER TABLE [dbo].[TicketInvitations] WITH CHECK ADD CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId] FOREIGN KEY([TicketId])
REFERENCES [dbo].[Tickets] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[TicketInvitations] CHECK CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customers] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId] FOREIGN KEY([ServiceMailboxId])
REFERENCES [dbo].[ServiceMailboxes] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId] FOREIGN KEY([ParentId])
REFERENCES [dbo].[Tickets] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId]
GO

Similar Messages

  • Apex 4.2 Report region sql query with "apex_item.text" renders wrongly

    In APEX 4.2 page i have created region "Report data".
    Type="SQl Query".
    "User Interface"-->"Template"="Reports Region".
    "Region Source"="select apex_item.text(1, '111') as c1 from dual".
    Actually the select query is little bit more complex, but generally simplified it is such, that it uses function "select apex_item.text" to construct HTML textfield.
    If i run in Sql Developer query
    select apex_item.text(1, '111') as c1 from dual;Then result is:
    <input type="text" name="f01" size="20" maxlength="2000" value="111"  />But in APEX 4.2 the report is rendered so:
    <td  headers="c1">&lt ;input type=&quot ;text&quot ; name=&quot;f01&quot; size=&quot;20&quot; maxlength=&quot;2000&quot; value=&quot;111&quot;  /&gt ;</td>(for this forum to display correctly i had to put extra spaces between" &gt" and ";" and so on)
    And APEX 4.2 shows ugly html inside report cell/slot for me, displaying characters/symbols ">". The reason is that APEX HTML page source does not have symbol ">" but has " &gt ;" .
    In APEX 3 i have similar query working well, without such anomaly.
    What attribute should i change in APEX 4.2 region to display my query result as needed?
    I need that function "apex_item.text", i cannot remove it.
    Edited by: CharlesRoos on 13.02.2013 15:28
    Edited by: CharlesRoos on 13.02.2013 15:29
    Edited by: CharlesRoos on 13.02.2013 15:29

    CharlesRoos wrote:
    In APEX 4.2 page i have created region "Report data".
    Type="SQl Query".
    "User Interface"-->"Template"="Reports Region".
    "Region Source"="select apex_item.text(1, '111') as c1 from dual".
    Actually the select query is little bit more complex, but generally simplified it is such, that it uses function "select apex_item.text" to construct HTML textfield.
    If i run in Sql Developer query
    select apex_item.text(1, '111') as c1 from dual;Then result is:
    <input type="text" name="f01" size="20" maxlength="2000" value="111"  />But in APEX 4.2 the report is rendered so:
    <td  headers="c1">&lt ;input type=&quot ;text&quot ; name="f01" size="20" maxlength="2000" value="111"  /&gt ;</td>(for this forum to display correctly i had to put extra spaces between" &gt" and ";" and so on)
    And APEX 4.2 shows ugly html inside report cell/slot for me, displaying characters/symbols ">". The reason is that APEX HTML page source does not have symbol ">" but has " &gt ;" .
    In APEX 3 i have similar query working well, without such anomaly.
    What attribute should i change in APEX 4.2 region to display my query result as needed?Ensure that the Display As Column Attribute for the C1 column is Standard Report Column.

  • How to write sql query with many parameter in ireport

    hai,
    i'm a new user in ireport.how to write sql query with many parameters in ireport's report query?i already know to create a parameter like(select * from payment where entity=$P{entity}.
    but i don't know to create query if more than 1 parameter.i also have parameter such as
    $P{entity},$P{id},$P{ic}.please help me for this.
    thanks

    You are in the wrong place. The ireport support forum may be found here
    http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=showcat&catid=9

  • Perhaps a little bit more speed?

    Hi,
    I'm on Option 1 on the Great Barford exchange (SMGB) - Somewhat rural, and about a kilometer away from the exchange.
    Just wondering if there's any way I can get a little bit more speed from my line; Purely because although the speed I'm getting now is fine, I am just curious to see what could be done to perhaps make it a bit faster?
    I'm connected directly at the NTE5, with an iPlate in situ, (which has noticibly made the line more stable!).
    My Line Stats from the HH are:
    Connection Information
    Line state:
    Connected
    Connection time:
    1 days, 00:02:10
    Downstream:
    2.344 Mbps
    Upstream:
    448 Kbps
    ADSL Settings
    VPI/VCI:
    0/38
    Type:
    PPPoA
    Modulation:
    G.992.1 Annex A
    Latency type:
    Interleaved
    Noise margin (Down/Up):
    9.9 dB / 16.0 dB
    Line attenuation (Down/Up):
    58.2 dB / 31.5 dB
    Output power (Down/Up):
    17.9 dBm / 11.9 dBm
    FEC Events (Down/Up):
    38595 / 34
    CRC Events (Down/Up):
    1543 / 20
    And from a speedtester.bt.com test;
     IP Profile for your line is - 2000 Kbps
     Download speed achieved during the test was - 1829 Kbps
     For your connection, the acceptable range of speeds is 400-2000 Kbps.
     Additional Information:
     Your DSL Connection Rate :2400 Kbps(DOWN-STREAM), 448 Kbps(UP-STREAM)
    Running a Quiet Line Test on 17070 using a BT corded phone gives me no noise.
    Thanks for your help
    Joe

    Haven't heard back from the mods yet, but I know it takes 3 days so no worries.
    Just to update you, here are the latest stats from my homehub;
    Connection Information
    Line state:
    Connected
    Connection time:
    2 days, 00:21:26
    Downstream:
    2.344 Mbps
    Upstream:
    448 Kbps
    ADSL Settings
    VPI/VCI:
    0/38
    Type:
    PPPoA
    Modulation:
    G.992.1 Annex A
    Latency type:
    Interleaved
    Noise margin (Down/Up):
    8.4 dB / 16.0 dB
    Line attenuation (Down/Up):
    58.2 dB / 31.5 dB
    Output power (Down/Up):
    17.9 dBm / 11.9 dBm
    FEC Events (Down/Up):
    61256 / 79
    CRC Events (Down/Up):
    2761 / 33
    All that seems to have changed is my downstream noise margin, which is good Hopefully this SNR reset'll help
    Thanks!
    Joe

  • SQL query with Bind variable with slower execution plan

    I have a 'normal' sql select-insert statement (not using bind variable) and it yields the following execution plan:-
    Execution Plan
    0 INSERT STATEMENT Optimizer=CHOOSE (Cost=7 Card=1 Bytes=148)
    1 0 HASH JOIN (Cost=7 Card=1 Bytes=148)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=4 Card=1 Bytes=100)
    3 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=3 Card=1)
    4 1 INDEX (FAST FULL SCAN) OF 'TABLEB_IDX_003' (NON-UNIQUE)
    (Cost=2 Card=135 Bytes=6480)
    Statistics
    0 recursive calls
    18 db block gets
    15558 consistent gets
    47 physical reads
    9896 redo size
    423 bytes sent via SQL*Net to client
    1095 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    55 rows processed
    I have the same query but instead running using bind variable (I test it with both oracle form and SQL*plus), it takes considerably longer with a different execution plan:-
    Execution Plan
    0 INSERT STATEMENT Optimizer=CHOOSE (Cost=407 Card=1 Bytes=148)
    1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=3 Card=1 Bytes=100)
    2 1 NESTED LOOPS (Cost=407 Card=1 Bytes=148)
    3 2 INDEX (FAST FULL SCAN) OF TABLEB_IDX_003' (NON-UNIQUE) (Cost=2 Card=135 Bytes=6480)
    4 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=2 Card=1)
    Statistics
    0 recursive calls
    12 db block gets
    3003199 consistent gets
    54 physical reads
    9448 redo size
    423 bytes sent via SQL*Net to client
    1258 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    55 rows processed
    TABLEA has around 3million record while TABLEB has 300 records. Is there anyway I can improve the speed of the sql query with bind variable? I have DBA Access to the database
    Regards
    Ivan

    Many thanks for your reply.
    I have run the statistic already for the both tableA and tableB as well all the indexes associated with both table (using dbms_stats, I am on 9i db ) but not the indexed columns.
    for table I use:-
    begin
    dbms_stats.gather_table_stats(ownname=> 'IVAN', tabname=> 'TABLEA', partname=> NULL);
    end;
    for index I use:-
    begin
    dbms_stats.gather_index_stats(ownname=> 'IVAN', indname=> 'TABLEB_IDX_003', partname=> NULL);
    end;
    Is it possible to show me a sample of how to collect statisc for INDEX columns stats?
    regards
    Ivan

  • SQL query with JSP and WML-parameters

    Hey,
    Could you help me?
    I'm trying to do the following. WML deck card 1 send parameter to same WML deck's card help. I try to read the parameter with JSP in card help by putting the parameter to SQL query, but it doesn't work. I can read the parameter with WML in card help. I can also print the value of the parameter with JSP if I generate WML with JSP.
    /*parameter sending from card 1 to card help*/
    out.println("<go href='#helpcard'>");
    out.println("<setvar name='valittukurssi' value='$(valittukurssi)'/>");
    /*parameter read with WML in card help */
    <p>Valitse kurssi.
    $valittukurssi</p>
    /'parameter read with JSP by generating WML with JSP*/
    out.println("<p>$valittukurssi</p>");
    /* SQL query with JSP */
    ResultSet uudettulokset = uusilause.executeQuery("select * from kurssi where lyhenne='$valittukurssi'");
    Thanks,
    Rampe

    You're problem is easy to fix. You're confusing WML variables with JSP variables. See below:
    >
    /*parameter sending from card 1 to card help*/
    out.println("<go href='#helpcard'>");
    out.println("<setvar name='valittukurssi'
    value='$(valittukurssi)'/>");
    Above you set a var that will work on the phone, not in JSP.
    /*parameter read with WML in card help */
    <p>Valitse kurssi.
    $valittukurssi</p>
    Yes the above does display the parameter, because it is a client side WML var, but you cannot use this variable in the JSP code (that's why your SWL fails).
    /'parameter read with JSP by generating WML with
    JSP*/
    out.println("<p>$valittukurssi</p>");Here's you're problem, the above line is EXACTLY the same as the one before it. When the container parses through this JSP code it translates the above line to:
    <p>$valittukurssi</p> on the WML page and the CLIENT uses it's local variable to display it.
    What you need and want is to have a variable that can be used in JSP code and output to your WML page. Here's how it's done:
    out.println("<go href='#helpcard'>");
    String some_name = "valittukurssi";
    out.println("<setvar name='"+some_name+"'
    value='$("+some_name+")'/>");
    //note that you may have to escape the ( and ) with a \
    //so we displayed the variable above into the WML page, now we can use it in the SQL query:
    /* SQL query with JSP */
    ResultSet uudettulokset =
    uusilause.executeQuery("select * from kurssi where
    lyhenne='"+some_name+"'");//the end of the command is: " ' " ) ;
    Frank Krul
    Got Node?

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • How could I replace hard coded value in my sql query with constant value?

    Hi all,
    Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
    PROCEDURE class_by_day_get_bin_data
         in_report_parameter_id   IN   NUMBER,
         in_site_id               IN   NUMBER,
         in_start_date_time       IN   TIMESTAMP,
         in_end_date_time         IN   TIMESTAMP,
         in_report_level_min      IN   NUMBER,
         in_report_level_max      IN   NUMBER
    IS
      bin_period_length   NUMBER(6,0); 
    BEGIN
      SELECT MAX(period_length)
         INTO bin_period_length
        FROM bin_data
         JOIN site_to_data_source_lane_v
           ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
         JOIN bin_types
           ON bin_types.bin_type = bin_data.bin_type 
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
       SELECT site_to_data_source_lane_v.site_id,
             site_to_data_source_lane_v.site_lane_id,
             site_to_data_source_lane_v.site_direction_id,
             site_to_data_source_lane_v.site_direction_name,
             bin_data_set.start_date_time,
             bin_data_set.end_date_time,
             bin_data_value.bin_id,
             bin_data_value.bin_value
        FROM bin_data
        JOIN bin_data_set
          ON bin_data.bin_serial = bin_data_set.bin_serial
        JOIN bin_data_value
          ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
        JOIN site_to_data_source_lane_v
             ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
            AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) lane_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'LANE'
                  AND report_parameters.report_parameter_name  = 'LANE'
             ) report_lanes
          ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) class_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'CLASS'
                  AND report_parameters.report_parameter_name  = 'CLASS'
             ) report_classes
          ON bin_data_value.bin_id = report_classes.class_id
        JOIN edr_rpt_tmp_inclusion_table
          ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data_set.start_date_time >= in_start_date_time
         AND bin_data_set.start_date_time <  in_end_date_time
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       =  bin_period_length;
    END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
    bin_data.bin_type            =  2But I dont want any hard coded number or string in the query.
    How could I replace it?
    I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
    bin_type     CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
    Thanks.
    Edited by: user10641405 on May 29, 2009 1:38 PM

    Declare the constant inside the procedure.
    PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
                                        in_site_id             IN NUMBER,
                                        in_start_date_time     IN TIMESTAMP,
                                        in_end_date_time       IN TIMESTAMP,
                                        in_report_level_min    IN NUMBER,
                                        in_report_level_max    IN NUMBER) IS
      bin_period_length NUMBER(6, 0);
      v_bin_type     CONSTANT NUMBER := 2;
    BEGIN
      SELECT MAX(period_length)
        INTO bin_period_length
        FROM bin_data
        JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                           site_to_data_source_lane_v.data_source_id
        JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time >=
             in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time <
             in_end_date_time + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type = v_bin_type
         AND bin_data.period_length <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
      INSERT INTO edr_class_by_day_bin_data
        (site_id,
         site_lane_id,
         site_direction_id,
         site_direction_name,
         bin_start_date_time,
         bin_end_date_time,
         bin_id,
         bin_value)
        SELECT site_to_data_source_lane_v.site_id,
               site_to_data_source_lane_v.site_lane_id,
               site_to_data_source_lane_v.site_direction_id,
               site_to_data_source_lane_v.site_direction_name,
               bin_data_set.start_date_time,
               bin_data_set.end_date_time,
               bin_data_value.bin_id,
               bin_data_value.bin_value
          FROM bin_data
          JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
          JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
                                 bin_data_value.bin_data_set_serial
          JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                             site_to_data_source_lane_v.data_source_id
                                         AND bin_data_set.lane =
                                             site_to_data_source_lane_v.data_source_lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'LANE'
                   AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
                                                                                         report_lanes.lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'CLASS'
                   AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
                                                                                            report_classes.class_id
          JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
                                              TRUNC(edr_rpt_tmp_inclusion_table.date_time)
         WHERE site_to_data_source_lane_v.site_id = in_site_id
           AND bin_data.start_date_time >=
               in_start_date_time - numtodsinterval(1, 'DAY')
           AND bin_data.start_date_time <
               in_end_date_time + numtodsinterval(1, 'DAY')
           AND bin_data_set.start_date_time >= in_start_date_time
           AND bin_data_set.start_date_time < in_end_date_time
           AND bin_data.bin_type = v_bin_type
           AND bin_data.period_length = bin_period_length;
    END class_by_day_get_bin_data;

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • Extract Sql Query with Actual Parameters from Report

    Hi
    I am able to extract query from Crystal Report using the following code :
    ReportDocument.ReportClientDocument.RowSetController.GetSqlStatement(new GroupPath, out tmp);
    But the sql query retrieve comes in the following format :
    select name , trans_code, account_code from command_query.accounts
    where account_code = {?Command_query_Prompt0}  and effective_date < '{?Command_query_prompt1 }'
    The parameters which I m using in the reports are :
    Account_Code and Effective_Date .
    Why does my extracted sql translates it into {?Command_query_Prompt0} and '{?Command_query_prompt1 }' .
    Is there any way to map this to the actual parameter values ?
    OR
    Can we extract the query after assigning the values ?
    Any help is appreciated ... 
    Thanks
    Sanchet

    hi,
    You can create nested sql query with conditional parameters,
    For example
    Select Code From OITT Where Code IN (Select ItemCode From OITM
    Where ItemName LIKE '[%0]' + '%%')
    Edited by: Jeyakanthan A on Jun 9, 2009 12:31 PM

  • Hosting company does not support SQL query with OUTFILE clause

    From my mysql database, I want to allow the user to run a query and produce a csv / text file of our membership database.   Unfortunately,  I just found out my hosting company does not support the SQL query with OUTFILE clause for MySQL database.
    Are there any other options available to produce a file besides me running the query in phpadmin and making the file available to users.
    Thanks.  George

    Maybe this external Export Mysql data to CSV - PHP tutorial will be of help
    Cheers,
    Günter

  • SQL Query With Like Operator - Performance is very poor - Oracle Apps Table

    Hi,
    I'm querying one of the Oracle Applications Standard Table. The performance is very slow when like operator is used in the query condition. The query uses a indexed column in the where clause.
    The query is..
    select * from hz_parties
    where upper(party_name) like '%TOY%'
    In the above case, It is not using the index and doing full table scan. I have checked the explain plan and the cost is 4496.
    select * from hz_parties
    where upper(party_name) like 'TOY%'
    If I remove the '%' at the begining of the string, the performance is good and it is using the index. In this case, the cost is 5.
    Any ideas to improve the performance of the above query. I have to retrieve the records whose name contains the string. I have tried hints to force the use of index. But it is of no use.
    Thanks,
    Rama

    If new indexes are disallowed, not a lot of good ones, no.
    If you know what keyword(s) are going to be searched for, a materialized view might help, but I assume that you're searching based on user input. In that case, you'd have to essentially build your own Text index using materialized views, which will almost certainly be less efficient and require more maintenance than the built-in functionality.
    There may not be much you could do to affect the query plan in a reasonable way. Depending on the size of the table, how much RAM you're willing to throw at the problem, how your system is administered, and what Oracle Apps requires/ prohibits in terms of database configuration, you might be able to force Oracle to cache this table so that your full table scans are at least more efficient.
    Justin

  • Query Tuning - using CASE statement in the WHERE clause - Duplicate Post

    Duplicate Post by mistake.
    Please check
    Query Tuning - using CASE statement in the WHERE clause
    Edited by: Chaitanya on Jun 9, 2011 2:45 AM
    Edited by: Chaitanya on Jun 9, 2011 2:46 AM

    Duplicate Post by mistake.
    Please check
    Query Tuning - using CASE statement in the WHERE clause
    Edited by: Chaitanya on Jun 9, 2011 2:45 AM
    Edited by: Chaitanya on Jun 9, 2011 2:46 AM

  • Are there any known issues with Adobe Edge Animate and Yosemite? Experiencing performance issues since upgrading OS

    Are there any known issues with Adobe Edge Animate and Yosemite? Experiencing performance issues since upgrading OS. Animation I was working on that had been performing in browser fine suddenly stopped working, and was not related to any action I had done at that point. Also was working in it today and program stopped responding to key board short cut commands.

    I am having a whole slew of odd interface problems with a fresh 2014.1.1 on a fresh macbook pro with latest Yosemite. Program locks up, cursor selections don't show, things disappear. I have a mac mini also and the program runs fine on it. Is there possibly something related to the solid state hard drive in new macs?

  • Learning SQL Query with JCheckBox and JButton

    Hello,
    I am learning how to access a very simple Access table. I am able to connect to the database and return a simple query. As I make it more complicated is where I have confused myself. The program is suppose to allow the user to pick any field they want to query using JCheckBox. After they have checked the fields off, the run query button is hit and outputs the results in a JOPtion Pane with a JTable. I am trying to do a test run and I can't make the query at least output something. If I can get any clues to the right direction would be appreciated. Thanks.
    package mypackage25;
    import java.sql.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class QueryAddressBook extends JFrame
        private JLabel selectQueryLabel;
        private JCheckBox firstName, lastName,
                       telephone, addressI, addressII, city,
                       state, zip;
        private JPanel selectQueryPanel, checkBoxPanel, executePanel;
        private JButton runQueryButton, clearSQLButton;
        private Connection connection;
        private Statement statement;
        private ResultSet resultSet;
        public QueryAddressBook()
          super("Query an Address Book");
          //Driver and Connection
          try
          //Driver for MicrosoftAccess
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          //Inform the user that the Driver was loaded successfully
          System.out.println("Driver Loaded");
          //Connect to specific database(i.e. MyAddress3) in Access
          Connection connection=DriverManager.getConnection("jdbc:odbc:MyAddress3");
          //Inform User
          System.out.println("Database connected");
          }//end try
          catch(ClassNotFoundException cnfe)
            cnfe.printStackTrace();
          }//end catch
          catch(SQLException sqle)
            sqle.printStackTrace();
          }//end catch
          //get content pane and set its layout
          Container container=getContentPane();
          container.setLayout(new BorderLayout());
          //GUI Components
          selectQueryLabel=new JLabel("Select Fields to be Queried");
          firstName=new JCheckBox("First Name");
          lastName=new JCheckBox("Last Name");
          telephone=new JCheckBox("Telephone");
          addressI=new JCheckBox("Address I");
          addressII=new JCheckBox("Address II");
          city=new JCheckBox("City");
          state=new JCheckBox("State");
          zip=new JCheckBox("Zipcode");
          //register listeners for JCheckBoxes
          CheckBoxHandler handler=new CheckBoxHandler();
          firstName.addItemListener(handler);
          lastName.addItemListener(handler);
          telephone.addItemListener(handler);
          addressI.addItemListener(handler);
          addressII.addItemListener(handler);
          city.addItemListener(handler);
          state.addItemListener(handler);
          zip.addItemListener(handler);
          //set up selectQueryPanel
          selectQueryPanel=new JPanel();
          selectQueryPanel.setLayout(new FlowLayout());
          selectQueryPanel.add(selectQueryLabel);
          //set up CheckBox Panel
          checkBoxPanel=new JPanel();
          checkBoxPanel.setLayout(new FlowLayout());
          checkBoxPanel.add(firstName);
          checkBoxPanel.add(lastName);
          checkBoxPanel.add(telephone);
          checkBoxPanel.add(addressI);
          checkBoxPanel.add(addressII);
          checkBoxPanel.add(city);
          checkBoxPanel.add(state);
          checkBoxPanel.add(zip);
          //set up execute panel
          executePanel=new JPanel();
          executePanel.setLayout(new FlowLayout());
          //set up buttons
          runQueryButton=new JButton("Run Query");
          clearSQLButton=new JButton("Clear SQL");
          runQueryButton.addActionListener
            new ActionListener()
              public void actionPerformed(ActionEvent event)
                if(event.getSource().equals(runQueryButton))
                  runSQLQuery();
          executePanel.add(runQueryButton);
          executePanel.add(clearSQLButton);
          container.add(selectQueryPanel, BorderLayout.NORTH);
          container.add(checkBoxPanel, BorderLayout.CENTER);
          container.add(executePanel, BorderLayout.SOUTH);
          setSize(800,150);
          setVisible(true);
        public static void main(String args[])
          QueryAddressBook dwgui=new QueryAddressBook();
          dwgui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }//end main
        //private inner class for ItemListener event handling
        private class CheckBoxHandler implements ItemListener
          public void itemStateChanged(ItemEvent event)
          }//end method itemStateChanged
        }//end private inner class CheckBoxHandler
        private void runSQLQuery()
          String output="";
          try
            statement=connection.createStatement();
            resultSet=statement.executeQuery("select firstName from address");
            while(resultSet.next())
              output+=resultSet.getString(1)+"\n";
            JOptionPane.showMessageDialog(null,output);
            System.out.println(output);
          }//end try
          catch(SQLException sqle)
            sqle.printStackTrace();
          }//end catch
        }//end runSQLQuery
    }//end class

    At present your query string is
    "Select firstName from Address"
    Instead of using the above hardcoded string, try to build the
    query String using logic that checks which check boxes are selected
    by the user.
    Example..
    String query = "SELECT ";
    if (firstName.isSelected()) {
    query = query + " firstName";
    Be sure, you add the comma properly between two fields :-)

Maybe you are looking for