KRayudu V

KRayudu V

  • NA
  • 155
  • 202.2k

pivot dynamic column

Mar 19 2014 8:59 AM
This is table im using
my task is to get course id values as fields dynamically that means,i dont need to mention courseid values but i should get values as fields with registerno and take as max markes for each register no and courseid values
 
 
 
 
 
 
 
 
 
 
 
 
 
CREATE TABLE [dbo].[tblResultMarkDetails](
[RId] [int] IDENTITY(1,1) NOT NULL,
[RegisterNo] [char](12) NOT NULL,
[DummyNo] [varchar](20) NULL,
[CourseID] [char](9) NOT NULL,
[Marks] [numeric](5, 2) NULL,
[GradeCode] [char](3) NULL,
[AppStatus] [char](1) NULL,
[Remark] [varchar](150) NULL,
[ASessionCode] [char](2) NOT NULL,
[ExamScheduleID] [char](6) NOT NULL,
[BatchId] [char](12) NOT NULL,
[ResultStatus] [char](4) NULL,
[InternalID] [char](3) NOT NULL,
[ExamType] [char](2) NOT NULL,
[Attempt] [bigint] NULL,
[YearPassed] [char](10) NULL,
[AttStatus] [char](1) NULL,
[PublishedOn] [datetime] NULL,
[PublishFlag] [char](1) NULL,
[PRCStatus] [char](1) NULL,
[CreatedDate] [datetime] NOT NULL,
[CreatedBy] [varchar](30) NULL,
[ModifiedDate] [datetime] NULL,
[ModifiedBy] [varchar](30) NULL,
[Mode] [varchar](15) NULL,
[CreditPoint] [numeric](5, 2) NULL,
[UFM] [char](1) NULL,
[PrivilegeCode] [varchar](9) NULL,
CONSTRAINT [PK_tblResultMarkDetails1] PRIMARY KEY CLUSTERED
(
[RId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]