Forum Replies Created

Viewing 15 posts - 3,166 through 3,180 (of 10,144 total)

  • RE: How to combine two codes

    SELECT

    a, -- column is in #TableA only

    b, -- column is in #TableA only

    c, -- column is in #TableA only

    d, -- column is in both tables

    e =...

  • RE: How to combine two codes

    The output columns of #header (and #body?) in this new post are completely different to earlier posts. Are you simply describing the data types of these columns or proposing a...

  • RE: getting null values while imporing from excel

    visu.viswanath (7/8/2014)


    Thanks for replay, i have one more doubt ...

    Is there any limitation for file size through query not from SSIS package.

    it gives error message as

    "server is not responding...

  • RE: Inserting a dash between some values AND Adding a leading zero if only 5 characters

    C-kweldude (7/7/2014)


    ...I have a column with integer records of 5 and 6 characters....

    What datatype is the column? It's not clear if you are describing the datatype or the content.

  • RE: very slow performance

    Here's an alternative using APPLY:

    SELECT s.Sheet_ID, s.Sheet_Month, s.Sheet_Year, s.Sheet_Period,

    s.Date_Start, s.Date_End, s.Date_Submit, s.Date_Approved, s.PD,

    s.Emp_ID, s.Dept_ID, s.Emp_Status, s.Comments, s.Supervisor_ID,

    s.Sheet_Status, s.Submit_ID, s.Approve_ID,

    TOTAL_Sheet = SUM(r.Record_Hours) OVER(PARTITION BY r.Sheet_ID),

    sp1.Supervisor_Name,

    sp2.Submit_Name,

    sp2.Submit_Email,

    sp3.Approve_Name,

    sp3.Approve_Email,

    DAY(r.Record_Date)...

  • RE: How to combine two codes

    That's why I put the query which had the most columns first in the UNION. The NULL placeholders in query 2 don't need datatyping. You only have to investigate the...

  • RE: How to combine two codes

    hoseam (7/7/2014)


    So what about the data types from #Header and #Body since we going to Union both queries?

    Quite. I could guess them for you, or you could investigate what they...

  • RE: Minimum datetime value

    Cadavre (7/7/2014)


    ChrisM@Work (7/7/2014)


    SELECT TOP 1 *

    FROM (

    SELECT *, rn = ROW_NUMBER() OVER(ORDER BY c1)

    FROM #Test

    ) d

    ORDER BY CASE WHEN c3 = 1 THEN 0 ELSE 1 END, rn

    Why does it...

  • RE: Display row even if data is null

    You're welcome, no worries 🙂

  • RE: Display row even if data is null

    SELECT mc.COUNTRY_DSC, alias.POL_LOCATION_CD, alias.TEU, mcc.TYPE_CD

    FROM MG_COUNTRY mc

    LEFT JOIN (VALUES

    ('Germany'),('Austria'),('Netherlands'),('Belgium'),('France'),

    ('Ireland'),('Sweden'),('Finland'),('Denmark'),('Norway')

    ) d (COUNTRY_DSC)

    ON d.COUNTRY_DSC = mc.COUNTRY_DSC

    LEFT JOIN MG_OFFICE mo

    ON mo.COUNTRY_CD = mc.COUNTRY_CD

    LEFT JOIN MG_BOOKING_DATASET mgd

    on mgd.BOOKING_OFFICE_CD = mo.OFFICE_CD

    AND alias.Booking_status_cd in...

  • RE: Display row even if data is null

    SELECT d.COUNTRY_DSC, alias.POL_LOCATION_CD, alias.TEU, mcc.TYPE_CD

    FROM (VALUES

    ('Germany'),('Austria'),('Netherlands'),('Belgium'),('France'),

    ('Ireland'),('Sweden'),('Finland'),('Denmark'),('Norway')

    ) d (COUNTRY_DSC)

    LEFT JOIN MG_COUNTRY mc

    ON mc.COUNTRY_DSC = d.COUNTRY_DSC

    LEFT JOIN MG_OFFICE mo

    ON mo.COUNTRY_CD = mc.COUNTRY_CD

    LEFT JOIN MG_BOOKING_DATASET mgd

    on mgd.BOOKING_OFFICE_CD = mo.OFFICE_CD

    AND alias.Booking_status_cd in...

  • RE: Display row even if data is null

    SELECT alias.COUNTRY_DSC, alias.POL_LOCATION_CD, alias.TEU, mcc.TYPE_CD

    FROM MG_COUNTRY mc

    LEFT join MG_OFFICE mo

    ON mo.COUNTRY_CD = mc.COUNTRY_CD

    LEFT JOIN MG_BOOKING_DATASET mgd

    on mgd.BOOKING_OFFICE_CD = mo.OFFICE_CD

    AND alias.Booking_status_cd in ('H','F','I','P')

    LEFT join MG_BOOKING_EQUIPMENT_REQ ber

    on mgd.BOOKING_ID = ber.BOOKING_ID

    LEFT join MG_CONTAINER_CODE...

  • RE: Minimum datetime value

    SELECT TOP 1 *

    FROM (

    SELECT *, rn = ROW_NUMBER() OVER(ORDER BY c1)

    FROM #Test

    ) d

    ORDER BY CASE WHEN c3 = 1 THEN 0 ELSE 1 END, rn

  • RE: How to combine two codes

    hoseam (7/7/2014)


    I'm running the Code in Toad Oracle, so #temp doesn't work there.

    Are you working with SQL Server or Oracle? This is the SQL Server 2008 forum section. Answers provided...

  • RE: Inserting value for identity column in a temporary table

    kishore1a1216 (7/6/2014)


    If the FROM table ALSO have identity Column then what we do ?

    I am Facing this Problem ..

    SELECT IDENTITY(int, 1, 1) AS 'RowID',* ,ROW_NUMBER() OVER(PARTITION BY UID ORDER BY...

Viewing 15 posts - 3,166 through 3,180 (of 10,144 total)