Forum Replies Created

Viewing 15 posts - 1,171 through 1,185 (of 1,419 total)

  • Reply To: Find and Copy Data from Another Table

    update c
    set
    dob=i.dob
    from
    customers c
    join
    info i on c.id=i.id;

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: math issue

    Does this return the correct answer?

    declare
    @company_name varchar(36)='Cash4WhateverTX',
    @return_code ...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: math issue

    ;with
    c4w_cte(co_name_count) as (
    SELECT CAST((Count(rr.[company_name]) + 1) AS decimal(10,2))
    FROM [dbo].[return_rows] rr
    WHERE [return_code] = 'R01'
    AND rr.[company_name] =...

    • This reply was modified 6 years, 6 months ago by Steve Collins. Reason: Mis-pasted

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Insert Data and read all Foreign Keys/Constraints first

    ScottPletcher wrote:

    I think it would be more accurate and far less work to rely on the existing constraints. 

    Yes yes.  Even if checks are performed in advance it's no guarantee the...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Excecute dynamic

    Phil Parkin wrote:

    DBCC TIMEWARP at its best.

    Then set the recovery model to "Trust Me We'll Be OK"

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: SQL Server Agent not running on Linux

    What happens if you restart the service?  According to the docs the service needs to be restarted after 'set sqlagent.enabled true'.  If that doesn't work I'd make a support call.

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Excecute dynamic

    According to the timestamps you answered your own question half a day before it was even asked!

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: binary tree

    You could create a table (b_tree) to store your numeric data in a single column.  Then assign additional columns based on common attributes of the numbers.

    column1: your numbers

    column2: applies to...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: UPDATE statement on CTE with INNER JOIN

    In the FROM clause of the UPDATE statement you list the table 'Orders'.  My guess is you intend for this to be the CTE but if the schema is not...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Need to replace this inefficient CASE statement

    I agree.  The answers are equivalent at best.

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Need to replace this inefficient CASE statement

    drop proc if exists dbo.test_case_cross;
    go
    create proc dbo.test_case_cross
    @node_order int,
    @Record_Key_4 ...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Need to replace this inefficient CASE statement

    Here's how I'm testing it.  I'm switching over to John and Jonathan's in the case where there are not nullable columns.  Still with the CROSS JOIN.  Wait a sec

     

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Need to replace this inefficient CASE statement

    Yeah I'm getting counterexamples too including my own.  Which columns can be NULL?

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Need to replace this inefficient CASE statement

    ...
    from
    Popup_Switches ps
    cross join
    #temp_1 t
    where
    ps.popup_gid in(2, 5)
    and t.node_order=1
    and (t.record_Key_4 = '1' or t.Record_Key_5 NOT IN ('I', 'X'));

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Need to replace this inefficient CASE statement

    It's an unusual query.  There's no join condition so it's really a CROSS JOIN.  I would guess the temp table always returns 1 row.  No matter what this query will...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

Viewing 15 posts - 1,171 through 1,185 (of 1,419 total)