Forum Replies Created

Viewing 15 posts - 5,476 through 5,490 (of 10,144 total)

  • RE: Merge Duplicate values

    SELECT

    nameid,

    telephone1 = MAX(CASE WHEN rn = 1 THEN telephone END),

    telephone2 = MAX(CASE WHEN rn = 2 THEN telephone END),

    telephone3 = MAX(CASE WHEN rn = 3 THEN...

  • RE: Temp table for Performance Impact

    TheSQLGuru (10/4/2012)


    1) What is the point of this (isn't PRIMARY KEY sufficient by itself and the UNIQUE redundant?):

    PRIMARY KEY (ID),

    UNIQUE (ID))

    2) I can probably count on...

  • RE: Merge Duplicate values

    Do you have another column in your existing table to identify what type of phone number it is? Mobile/work/home etc?

  • RE: Paging data with CTE

    PiMané (10/4/2012)


    ChrisM@Work (10/4/2012)


    SSC has just the article for you, right here[/url]. No need to redesign the wheel just yet 😉

    My initial thoughts are right then 🙂

    Thx,

    Pedro

    Reckon so 😉

  • RE: Multipe letters into one

    dwain.c (10/4/2012)


    Eugene Elutin (10/4/2012)


    ChrisM@Work (10/4/2012)


    Eugene Elutin (10/4/2012)


    ChrisM@Work (10/4/2012)


    No undocumented vapourtables, no sort:

    SELECT n = a.n+b.n

    FROM (VALUES(0),(10),(20),(30),(40),(50),(60),(70),(80),(90))b(n)

    CROSS JOIN (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10))a(n)

    😉

    No sort? I would suggest to add ORDER BY, otherwise order is not...

  • RE: Multipe letters into one

    Eugene Elutin (10/4/2012)


    ChrisM@Work (10/4/2012)


    Eugene Elutin (10/4/2012)


    ChrisM@Work (10/4/2012)


    No undocumented vapourtables, no sort:

    SELECT n = a.n+b.n

    FROM (VALUES(0),(10),(20),(30),(40),(50),(60),(70),(80),(90))b(n)

    CROSS JOIN (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10))a(n)

    😉

    No sort? I would suggest to add ORDER BY, otherwise order is not guaranteed,...

  • RE: Paging data with CTE

    PiMané (10/4/2012)


    ChrisM@Work (10/4/2012)


    Why, in the second query, do you join the employees table to the CTE? I can't see any reason for it - unless there are dupes on EmpID....

  • RE: Multipe letters into one

    Eugene Elutin (10/4/2012)


    ChrisM@Work (10/4/2012)


    No undocumented vapourtables, no sort:

    SELECT n = a.n+b.n

    FROM (VALUES(0),(10),(20),(30),(40),(50),(60),(70),(80),(90))b(n)

    CROSS JOIN (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10))a(n)

    😉

    No sort? I would suggest to add ORDER BY, otherwise order is not guaranteed, so you may...

  • RE: Paging data with CTE

    PiMané (10/4/2012)


    PiMané (10/4/2012)


    ChrisM@Work (10/4/2012)


    Post the actual execution plans as .sqlplan attachments. It's difficult to determine anything useful from these figures.

    Thanks... here it is.

    Pedro

    The plans are almost the same except for...

  • RE: Multipe letters into one

    No undocumented vapourtables, no sort:

    SELECT n = a.n+b.n

    FROM (VALUES(0),(10),(20),(30),(40),(50),(60),(70),(80),(90))b(n)

    CROSS JOIN (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10))a(n)

    😉

  • RE: Optimizing the data

    This has to be homework because it's very simple.

    Try ROW_NUMBER() OVER (PARTITION BY something ORDER BY somethingelse)

    You will need to set it up as a CTE or derived table in...

  • RE: Help with Merge

    This should be close.

    MERGE [DBname].[dbo].[Space] AS target

    USING [DBname].[dbo].[RawData_Space] AS source

    ON target.SPACE_ID = source.SPACE_ID

    WHEN MATCHED THEN

    ...

  • RE: How to use GETDATE() function in sql server to select a column value from table whose date is only 1 year back from today.

    maida_rh (10/4/2012)


    How to use GETDATE() function in sql server to select a column value from table whose date is only 1 year back from today.

    E.g :

    Select LTRating ,RHDate from Accounts...

  • RE: Paging data with CTE

    Post the actual execution plans as .sqlplan attachments. It's difficult to determine anything useful from these figures.

  • RE: Why does this take so long!

    deepakagarwalathome (10/3/2012)


    Hi Chris

    Thanks for that!I fully understand what you are trying to do with the CTE's. I have run the query with the CTE's.

    The problem, however, remains the same, that...

Viewing 15 posts - 5,476 through 5,490 (of 10,144 total)