Forum Replies Created

Viewing 15 posts - 1,186 through 1,200 (of 3,348 total)

  • RE: Nested Case statements Help

    First, in SQL Server CASE is not a statement but an expression. That means that "when section=reading and value =start then time as start_Time" in itself will already throw a...

  • RE: Syntax help on UPDATE Please

    If every row in PARTB has at least one match in PROVIDER_IN, you can also use:

    UPDATE dbo.PARTB

    SET PROV_NBR = ( SELECT TOP (1) p.PROV_NBR

    ...

  • RE: Help need in using condition on join statement

    GilaMonster (1/7/2016)


    KGJ-Dev (1/7/2016)


    I am struggling to make it where to put like operator and where to put '%' at the end

    The = should have been a LIKE, sorry about...

  • RE: The Lonely Count

    Hugo Kornelis (1/7/2016)


    Rune Bivrin (1/7/2016)


    Interestingly enough, the most recent docs for COUNT() states that the OVER() requires the ORDER BY clause, which is patently untrue, at least up to SQL...

  • RE: Refresher - How to Mark the Latest Entries In a Set ?

    How about something like the below:

    SELECT Customer, ContractStart, ContractEnd,

    CASE WHEN ContractEnd = MAX(ContractEnd) OVER (PARTITION BY Customer) THEN 1 ELSE 0 END

    FROM YourTable;

    The MAX() OVER (PARTITION BY)...

  • RE: Help need in using condition on join statement

    The short answer is to replace <<expression>> with T2.Code

    The longer and better answer is to warn you about the weird behaviour of UPDATE FROM when there is no strict 1-to-1...

  • RE: Version Store and Index Seeks

    Ah okay, I missed the detail that the updated column is indexed.

    I did some digging (and some experiments with DBCC IND and DBCC PAGE - always fun!) and I now...

  • RE: SELECT JOIN AND INSERT QUERY

    Tallboy (1/7/2016)


    Hi Hugo,

    Your right, but every row from the source table could and will have different dates , therefor I need to use a cursor to iterate over them! ...

  • RE: Version Store and Index Seeks

    Once you enable snapshot isolation, SQL Server will add an extra invisible column to all tables. This column is a pointer to the version store. For committed data, this pointer...

  • RE: Dynamic Backup Script

    Yes, but you'll have to do some smart scripting to pull it off. The trick would be to have the file name for the backup generated such that it will...

  • RE: SELECT JOIN AND INSERT QUERY

    Since you already have a calendar table, generating the rows to be inserted should be easy with a join:

    INSERT INTO dbo.Appointments (column list)

    SELECT s.ClientID, c.Date, other, columns

    FROM dbo.SourceTable AS s

    INNER...

  • RE: Issue with using isowk

    Since we cannot change the laws of physics and are unlikely to get the world to accept an alternate calendar/clock system that does not align with daylight and seasons, the...

  • RE: Row_number partition by specific range of numbers start with int and ends with char

    For performance, I would capture the creative query with ROW_NUMBER in a temporary table, add a (clustered, nonunique) index on the row_number, and then copy the data to the new...

  • RE: The Lonely Count

    I like the question, but there are two small caveats.

    First is that I would have liked the answer to be phrased as "10 in all 10 rows" or something equivalent,...

  • RE: The Lonely Count

    Rune Bivrin (1/7/2016)


    Interestingly enough, the most recent docs for COUNT() states that the OVER() requires the ORDER BY clause, which is patently untrue, at least up to SQL 2012....

    Good discovery!...

Viewing 15 posts - 1,186 through 1,200 (of 3,348 total)