Forum Replies Created

Viewing 15 posts - 46 through 60 (of 4,080 total)

  • Reply To: Count Null Records with Group BY

    There is a difference between returning a null value and returning no rows.  What would the batchID be if there are no rows for a given batchID?

    If you have another...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: SELECT Name column from Name Table from either of 2 columns in main table

    Lots of ways to skin this cat.    You can join to the tblOperator table twice (one of them should be a match. ) and use COALESCE to get the...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: improvement suggestion

    I totally agree with Grant on searching against a function leading to table scans and the potential for an injection attack.    Even though you are using sp_ExecuteSQL, you are...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Counting Instances in TEXT

    The key to your problem is that you want two rows to be generated from a single rows.    My favorite technique for accomplishing this is to use CROSS APPLY...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Is this a RBAR?

    I agree.   Nested loops are not considered RBAR.    There are alternative ways to code for getting only the latest row, but the best thing you can do for performance...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Help filtering my WHERE clause

    Summing case statements instead of doing a PIVOT, is referred to as a cross tab.

    https://www.sqlservercentral.com/articles/cross-tabs-and-pivots-part-1-%e2%80%93-converting-rows-to-columns-1

    Also, I hear you talking about the overhead of a CROSS APPLY.    I've never experienced...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Sql query - Projected Monthly Revenue

    I feel compelled to confess that the calendar table I use has all the dates.    I'm actually delighted that the "Some people prefer"  invited such rebuttals.    Also those...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Are the posted questions getting worse?

    Apparently, I am serving SPAM too.    Just noticed this on the 2016 development forum.

    In: Pentobarbital for sale https://hospitableending.com/?

    By: The Dixie Flatline

    I've heard of "Phenobarbitol", but not Pentobarbital.   Go figure.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Help filtering my WHERE clause

    Scott, just asking for clarification.   You spoke of finding the UNPIVOT syntax kludgy (and I agree) but you posted the "crosstab" syntax which is the old-school way to PIVOT rows...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Sql query - Projected Monthly Revenue

    It's easy and flexible to include weekends in a Calendar table, usually with two flags one that says weekends, one that says holidays.  Sometimes Christmas falls on a Saturday, but...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Transactions

    I am just editing this message  because the more you look the stranger things seem.    I would have agreed with your comment about nested transactions.   But look what happens...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Lock Scenarios Using sys.dm_tran_locks

    One comment.    For your example #10, deleting a range of rows,  you used the following

    DELETE FROM EMPLOYEE WHERE FName LIKE '%Kokou%';

    Because the search argument began with...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Transactions

    I wouldn't expect to have to use two ROLLBACKS.   I thought one ROLLBACK set @@TRANCOUNT to zero.   (See below.)

    In any event, I've never seen a need to use SET IMPLICIT...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: How can do a loop select stmt from this folowing table

    declare @Sample_Data table 
    (
    id varchar(20) ,
    Eid varchar(20),
    typ varchar(20),
    dur float
    )

    insert into @Sample_Data (id,Eid,typ,dur) VALUES ('1','e1','t1','18.00');
    insert into @Sample_Data (id,Eid,typ,dur) VALUES ('2','e2','t1','14.00');
    insert into @Sample_Data (id,Eid,typ,dur) VALUES...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Data Warnings / Ignore Checked Results

    Just a  thought, and probably not a very good one.   But in lieu of status flags validating rows, or exclusion tables.   Why not remove suspect/invalid rows to other tables with...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 15 posts - 46 through 60 (of 4,080 total)