SQL Query For (Delphi - Advantage Database Server) - ASAP Please

  • I have a existing Dos based program in Clipper with a table entries as below

    Table Name: E0362CSD

    Column1: Originator              Column2: DocumentType                   Column3: Date

        Row1: Belhasa                     Row1: Document1                            row1: 16-06-05

        Row2: Belhasa                     Row2: Transmittal1                          row2: 18-06-05

        Row3: Etisalat                     Row3: RelyTransmittal1                     row3: 20-06-05

        Row4: Belhasa                     Row4: Document2                            row4: 16-06-05

        Row5: Belhasa                     Row5: Transmittal2                          row5: 19-06-05

        Row6: ReadyMix                   Row6: RelyTransmittal2                     row6: 22-06-05

     

    Now I want to get a report of one line which say all about Document1 as below

    Belhasa + Document1 + 16-06-05 + Transmittal1 + 18-06-05 + Etisalat + ReplyTransmittal1 + 20-06-05

    How do I get a report like this in a single SQl query.

    I tried but sorry i couldn't get that result ... Could u please help me.

    Thanks in advance.

    Neeraj

     

  • Here's a demo with the system tables.

    IF Object_id('ListTableColumns') > 0

    DROP FUNCTION ListTableColumns

    GO

    CREATE FUNCTION dbo.ListTableColumns (@TableID as int)

    RETURNS varchar(8000)

    AS

    BEGIN

    Declare @Items as varchar(8000)

    SET @Items = ''

    SELECT

    @Items = @Items + C.Name + ', '

    FROMdbo.SysColumns C

    WHEREC.id = @TableID

    AND OBJECTPROPERTY(@TableID, 'IsTable') = 1

    ORDER BYC.Name

    SET @Items = LEFT(@Items, ABS(DATALENGTH(@Items) - 2))

    RETURN @Items

    END

    GO

    Select dbo.ListTableColumns(Object_id('SysObjects'))

    --base_schema_ver, cache, category, crdate, deltrig, ftcatid, id, indexdel, info, instrig, name, parent_obj, refdate, replinfo, schema_ver, seltrig, stats_schema_ver, status, sysstat, type, uid, updtrig, userstat, version, xtype

    DROP FUNCTION ListTableColumns

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply