Forum Replies Created

Viewing 15 posts - 151 through 165 (of 3,544 total)

  • Reply To: SSIS SQL 2016 failing to import date value into a timestamp column!

    I am not aware of a single copy causing this unless it is propriety.

    I know DOS COPY using + to concatenate files certainly does (and always has done)

    ie COPY file1+file2...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: SQL Server Partial Unpivot for defined days columns, repeat rows by column

    drew.allen wrote:

    David Burrows wrote:

    SELECTt.COUNTRY_CODE,t.COMPANY_CODE,t.ITEM_NBR,t.Department,t.[Week],d.[Day],q.QTY
    FROM t
    CROSS JOIN (
    VALUES ('SUN'),('MON'),('TUE'),('WED'),('THU'),('FRI'),('SAT')
    ) d ([Day])
    CROSS APPLY (
    SELECT CASE d.[Day]
    WHEN 'SUN' THEN t.SUN_QTY
    WHEN 'MON' THEN t.MON_QTY
    WHEN 'TUE' THEN t.TUE_QTY
    WHEN 'WED' THEN t.WED_QTY
    WHEN 'THU' THEN...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: SSIS SQL 2016 failing to import date value into a timestamp column!

    Jeff Moden wrote:

    What is the default language for the server?

    Don't you mean login as the default language of the login dictates date conversion as described by Thom and could be different...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: SQL Server Partial Unpivot for defined days columns, repeat rows by column

    Phil's solution is what I would have done.

    Just for completeness

    SELECTCOUNTRY_CODE,COMPANY_CODE,ITEM_NBR,Department,[Week],[Day],QTY
    FROM(
    SELECTCOUNTRY_CODE,COMPANY_CODE,ITEM_NBR,Department,[Week],
    SUN_QTY,MON_QTY,TUE_QTY,WED_QTY,THU_QTY,FRI_QTY,SAT_QTY
    FROM
    ) p (COUNTRY_CODE,COMPANY_CODE,ITEM_NBR,Department,[Week],
    [SUN],[MON],[TUE],[WED],[THU],[FRI],[SAT])
    UNPIVOT(
    [QTY] FOR [Day] IN ([SUN],[MON],[TUE],[WED],[THU],[FRI],[SAT])
    ) a;
    SELECTt.COUNTRY_CODE,t.COMPANY_CODE,t.ITEM_NBR,t.Department,t.[Week],d.[Day],q.QTY
    FROM t
    CROSS JOIN (
    VALUES ('SUN'),('MON'),('TUE'),('WED'),('THU'),('FRI'),('SAT')
    ) d ([Day])
    CROSS APPLY...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: SQL Server Partial Unpivot for defined days columns, repeat rows by column

    I could not see any attachment.

    However two samples that may help

    SELECTID, DayNo, DayValue
    FROM(
    SELECTID, Val1, Val2, Val3, Val4, Val5, Val6, Val7
    FROM
    ) p (ID, [1], [2], [3], [4], [5],...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: Index and fragmentation

    Great explanation Jeff (as always) 🙂

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: Merge Columns when Column in Master-/PK-Row is NULL

    Jeff Moden wrote:

    Actually, the best thing to do would be to have an "Order_Header" table where the ORDER TYPE only needs to be noted once and then store the details in...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: Convert number to time

    Just make sure the number of seconds does not exceed one day otherwise the time will be wrong

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: Convert number to time

    Don't know Oracle but if the result of your math is number of seconds since midnight then

    CAST(DATEADD(second,(626400-432000)/10,0) as time)

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: Are the posted questions getting worse?

    Luis Cazares wrote:

    Steve Jones - SSC Editor wrote:

    Luis Cazares wrote:

    It's been good. We're still waiting for our baby girl to decide to be born. She's taking her time. (Yesterday was the "due date")

    I'm assuming by now...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: The First Rule

    Jeff Moden wrote:

    I also have AK's, which are also unique and are what you call "natural keys".  For me, they exist mostly to enforce the very uniqueness you speak of. ...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: Basics to loading data

    Jeff Moden wrote:

    Phil Parkin wrote:

    below86 wrote:

    IMHO, you are on the right path.  I'm currently doing exactly what you described.  Importing flat, delimited files to a 'staging' table where all fields are defined...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: How to group by the first column and limit its results?

    USE LAG instead of SAMPLING_POINT in the select like this

    CASE WHEN SAMPLE.SAMPLING_POINT = LAG(SAMPLE.SAMPLING_POINT,1,'') OVER (ORDER BY SAMPLE.SAMPLING_POINT ASC)
    THEN ''
    ELSE SAMPLE.SAMPLING_POINT
    END AS [SAMPLING_POINT]

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: Understanding the use of a CTE with MERGE

    GaryV wrote:

    If your temp table is the source of data for your MERGE, you don't need the CTE. 

    You would if you only wanted to affect a subset of TRANSDETAIL

    Otherwise the...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Reply To: trying to get all data to line up

    You need to produce a cartesion of unique employees (SELECT DISTINCT) and DateRange (CROSS JOIN) and LEFT JOIN the employees table

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 151 through 165 (of 3,544 total)