Home Forums SQL Server 2008 T-SQL (SS2K8) Importing only rows with column data in specific columns. RE: Importing only rows with column data in specific columns.

  • You never mentioned the subjects.

    You have to add them to the query that constructs the basedata (the selects with union all).

    with basedata (

    name,

    addy,

    ph,

    subject,

    grade

    ) as (

    select

    name,

    addy,

    ph,

    'Subject 1',

    grade1

    from

    sourcetable

    union all

    select

    name,

    addy,

    ph,

    'Subject 2',

    grade2

    from

    sourcetable

    union all

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2