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...

  • 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...

  • 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...

  • 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...

  • 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] =...
  • 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...

  • 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...

  • 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...
  • 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,...
  • Reply To: Comma separated value string and compare against other values

    Couple of ways to solve this.   First, you could do the following.

    1. Use the OUTPUT clause in conjuction with your delete to save the deleted AIDs to  a temporary table.
    2. ...

  • 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".

  • 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,...

  • 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...

  • 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.

  • 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...

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