• hey lynn !

    Table DDL:

    USE [OEAS]

    GO

    /****** Object: Table [dbo].[51] Script Date: 04/05/2013 21:16:07 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE TABLE [dbo].[51](

    [ID] [bigint] IDENTITY(1,1) NOT NULL,

    [Exam_ID] [bigint] NOT NULL,

    [Paper_ID] [bigint] NOT NULL,

    [Question_ID] [bigint] NOT NULL,

    [Section_ID] [bigint] NOT NULL,

    CONSTRAINT [PK_51] 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]

    GO

    Sample Data:

    INSERT INTO [OEAS].[dbo].[51] ([Exam_ID] ,[Paper_ID] ,[Question_ID] ,[Section_ID]) VALUES (1,1,3,1)

    INSERT INTO [OEAS].[dbo].[51] ([Exam_ID] ,[Paper_ID] ,[Question_ID] ,[Section_ID]) VALUES (1,1,10,1)

    INSERT INTO [OEAS].[dbo].[51] ([Exam_ID] ,[Paper_ID] ,[Question_ID] ,[Section_ID]) VALUES (1,1,12,1)

    Expected Output of SP :

    1;3|2;10|3;12|