Stored Procedure for Joins tables and Data Transformation

  • Hi,

    I have to develope one stored procedure. I have to pull the data from three tables and then transfer that data in to a flat file (.txt). So, please can anybody help me in this issue. If anybody having this type of SP then please send me.

    I really appreciate for your kind co-operations.

    Thanks & Regards,

    KP

  • SELECT *

    FROM Table1

    JOIN Table2

    ON Table1.Key = Table2.Key

    JOIN Table3

    ON Table1.Key = Table3.Key

    This assumes that the PK on Table1 matches an FK on Table2 & Table3. Either way, you can then use query anaylizer to output to text or run it through sqlcmd to output as text or some other process to output as text.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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