Home Forums SQL Server 2014 Development - SQL Server 2014 loop and query CSV files in a folder using union all query to form resultant table on server RE: loop and query CSV files in a folder using union all query to form resultant table on server

  • is this correct....

    UNION ALL

    SELECT t.*, (substring(t.[week],3,4))*1 as iYEAR,

    ''SPAIN'' as [sCOUNTRY], ''EURO'' as [sCHAR],

    IIf( t2.first_week_on_sale = 1 and t2.weeks_on_sale <=52,

    ((((substring(t.[week],3,4) - 2011) * 52) + right(t.[week],2)) - t2.first_week_on_sale) + (1 + 52 - t2.weeks_on_sale),

    ((((substring(t.[week],3,4) - 2011) * 52) + right(t.[week],2)) - t2.first_week_on_sale) + 1 ) as Sale_Week

    FROM [DATABASE_FRANCE_EURO.CSV] as t,

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day