Forum Replies Created

Viewing 15 posts - 4,066 through 4,080 (of 10,144 total)

  • RE: Difficult Sorting

    busraker (8/28/2013)


    Your solution would run much faster (my code must test every previous day in order to determine the proper sort order, and you rely on a case statement) but...

  • RE: Stunned

    Grant Fritchey (8/28/2013)


    Koen Verbeeck (8/28/2013)


    JLMayes (8/28/2013)


    TravisDBA (8/28/2013)


    Agreed, but let's make sure ALL the facts are uncovered first before calling anyone out. Otherwise, it just turns the whole situation into a...

  • RE: Select in select subquery

    TheSQLGuru (8/28/2013)


    ...general best practice in any case) is to ALWAYS use aliases for EVERYTHING...

    And again, just in case it was missed the first time around.

  • RE: Why is my query not working as expected?

    Can you post the actual execution plan, Kevin? As a .sqlplan attachment. It's the source of information for anyone wanting to optimise a query. There are plenty of folks around...

  • RE: Why is my query not working as expected?

    SQL Server is turning the OJ into an IJ because of the inner-joined "trail". You can get around it by changing the position of the ON clauses like this:

    SELECT P.policy_internal_id,

    RTRIM(P.contract_main_id)

    +...

  • RE: Query error

    shafibinyunus (8/28/2013)


    Try this..

    Declare @EndDate varchar(25)

    select @EndDate =CONVERT(varchar,(convert(varchar(10), getdate(), 101) + ' ' + CAST(DATEPART(hh,getdate()) AS VARCHAR) +':'+ CAST(DATEPART(mi,getdate()) as VARCHAR) +':'+ CAST(DATEPART(ss,getdate()) AS VARCHAR)+CAST(DATEPART(ss,getdate()) AS VARCHAR)),109 )

    print @EndDate

    This returns incorrect...

  • RE: Select in select subquery

    It's to support correlated subqueries like this:

    select *

    from test1 t1

    where t1.firstname1 in (select t2.firstname2 from test2 t2 where t2.firstname2 = t1.firstname1)

    and is equivalent to this:

    select *

    from test1...

  • RE: Update/Case query help

    Write a SELECT statement joining the two tables which outputs the PK of the table you want to update, the existing domain value, and the value you want to change...

  • RE: Stunned

    Revolting and unacceptable. But what has been done? What message will be sent out to this and other groups if nothing is done?

  • RE: Difficult Sorting

    Not bad at all, busraker. Here's a slight mod which I think is a little easier to figure out, but the logic I think is the same as yours:

    ;WITH CountedData...

  • RE: How to find orders that contain the same product

    Here's another way:

    SELECT p.ProductID, MAX(x.OrderList)

    FROM @OrderDetail p

    CROSS APPLY (

    SELECT STUFF(

    (SELECT ',' + CAST(o.OrderID AS varchar(5))

    FROM @OrderDetail o

    WHERE o.ProductID = p.ProductID

    ORDER BY o.OrderID

    FOR XML PATH(''))

    , 1, 1, ' ')...

  • RE: How to query same table with 2 WHERE clause onto 1 row

    John's correct, here's another way:

    SELECT

    col1 = MIN(CASE WHEN t.value = x.min_value THEN value ELSE NULL END),

    col2 = MIN(CASE WHEN t.value = x.min_value THEN t_stamp ELSE NULL END),

    col3...

  • RE: Query Help

    You haven't explained any rules for the assignment of 'flavour'. Will a guess be sufficient?

  • RE: How many columns in INCLUDED Index are 'Too Many' ???

    T.Ashish (8/27/2013)


    Hi Chris,

    Thanks again for your help.

    I could not see any performance difference with/without function. I have pasted the function for you. Meanwhile I'm looking into third point you suggested.

    CREATE...

  • RE: How many columns in INCLUDED Index are 'Too Many' ???

    A few comments.

    1. This personalisation:

    on wo . bu_id = bu . bu_id

    with unnecessary spaces either side of object delimiters, makes the code irritating to read and will put folks...

Viewing 15 posts - 4,066 through 4,080 (of 10,144 total)