Forum Replies Created

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

  • Reply To: DBCC Timewarp

    DAMMIT!!    I make one, ONE, typo on parameter 137 and suddenly I find myself here in the FUTURE!!

    Does anyone still follow this thread, and if so, can you give...

    __________________________________________________

    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 help

    I ask because you can get a fairly efficient solution to the example above using the LAG() function instead of a join.   But this assumes that there are no other...

    __________________________________________________

    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 help

    Edited to rephrase my question:

    What if there were two 'F' rows preceding the 'S' row?

    Do you only want data from the most recent 'F' row, prior to the 'S' row?

    Will...

    __________________________________________________

    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: UDF not working

    Jeff, one of the best things I ever heard about comments is this:

    Comments don't exist to describe what the code is doing.    They exist to describe what the code...

    __________________________________________________

    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: Parse a very large delimited string

    Why go to all the work of coding a cursor?    It's easy enough to do set-based if you CROSS APPLY the STRING_SPLIT() function.

    SELECT [ID], [SubName] =...

    __________________________________________________

    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: Joining 3 tables

    Just avoiding single aliases as a rule doesn't keep developers from using aliases like a1, a2, etc.     When there are just a few joins, I've never understood the panic...

    __________________________________________________

    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: Query Recommendations

    A "band-aid" for complex multiline table-valued functions is to use them only to write the data out to a #temp table, which you can then use for subsequent queries 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: VLOOKUP Equivalent in SQL

    If you include the Vlookup amount in your second table, you won't even require a case statement.

    declare @Table1 table (ID int identity(1,1) primary key, Amount int)
    insert into...

    __________________________________________________

    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: Count Group By and CASE

    Just to pile on, COUNT(expr) only counts non-null values, while Count(*)   counts rows.    See below.

    declare @table table (RowID int, RowData varchar(20))
    insert into @table
    values (1,'Hi Mom'), (2,...

    __________________________________________________

    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: Finding columns with null values

    Perhaps.    I was just going by his language that says the columns contain nulls.     I don't think he ever used the words "all" or "only".

    __________________________________________________

    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: Finding columns with null values

    Back to Jeff's point, the code as written will only return a hit if ALL rows are NULL for a particular column.   If even one row has a non-null value,...

    __________________________________________________

    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: Looking Forward to SQL Server vNext

    While I understand at least one reason why CTEs don't automatically generate a spool file for re-use, I have always wondered why there wasn't an object that you could re-use...

    __________________________________________________

    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: Pivot table for report

    You can run the query and output the data as a CSV, which Excel can load as a spreadsheet.

    __________________________________________________

    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 checksum works?

    EXCEPT  is great.   But to be clear, it doesn't require that the tables have identical structures, it compares the results of two queries.    You can select a subset of...

    __________________________________________________

    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: Transaction log and updates on large tables

    ScottPletcher wrote:

    The data still has to be read -- how else would SQL know that the proposed new value was the same as the value in the table itself?

    It's...

    __________________________________________________

    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 - 1 through 15 (of 4,080 total)