Forum Replies Created

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

  • Reply To: Len

    Why did you repost this?   You got at least two answers to your earlier "LEN" post that would work.     All you had to do was change the column names...

    __________________________________________________

    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: Len

    I just edited my post to give you the code based on len(ID).     Hope it helps.

     

    __________________________________________________

    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: Len

    A query can only return a fixed number of columns.   What is the maximum number of "ID" columns?       ID5?    ID100?

    The code below will rank the ID columns...

    __________________________________________________

    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: Dynamic parameter transfer in msdb.dbo.sp_send_dbmail

    A single query can't return a variable number of columns.    It would have to reflect one column for every month of the year and a total at the end.

     

     

    __________________________________________________

    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: Dynamic parameter transfer in msdb.dbo.sp_send_dbmail

    You say minutes in the previous month, but then you list the three previous months and say it must be in tabular form.

    Do you want each of the previous months'...

    __________________________________________________

    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: Copy data from Source Sql Server to another destination Sql Server DB Table

    Best practice would be to first import the data from the source server into a staging table.    (This can be done through BCP, SSIS, or by linked server.)   ...

    __________________________________________________

    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: Loan Amortization Schedule for SQL Server

    Forget I said anything about making interest rate per period a variable.   🙂

    __________________________________________________

    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: Loan Amortization Schedule for SQL Server

    Understand completely.    I really don't consider the rounding issue to be an error.    Just mildly annoying.    Please don't take anything I said as being critical !!   ...

    __________________________________________________

    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: Loan Amortization Schedule for SQL Server

    Nice work, and a fun solution, Jason.

    Just a couple of comments.

    I'm curious if it would save CPU cycles is to make the interest rate per period a variable.    I'm...

    __________________________________________________

    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: The Future Synonym

    An interesting use of synonyms provides flexibility for source or target table names in scripts and procedures.

    DECLARE  @InputTable varchar(100) = 'ContentX' -- this would be a...

    __________________________________________________

    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: When Do We Ask for Help?

    I am guilty of banging my head against something for more than an hour, but I have found that if you ask someone (anyone really) to lend you their eyes...

    __________________________________________________

    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: group parts by row count

    There's an easy way to create GroupIDs by size using the ROW_NUMBER() function and a little integer math.

    The example below uses a varchar column with ROW_NUMBER(), just to show that...

    __________________________________________________

    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 Many Rows Inserted?

    Per Paul Randal in https://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-2630-nested-transactions-are-real/

    The commit of a nested transaction has absolutely no effect – as the only transaction that really exists as far as SQL Server is concerned is...

    __________________________________________________

    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 Null Records with Group BY

    That would produce TWO result sets, Steve.    The second one would not have column names.   Plus you can't really union the two queries if you are relying on @@ROWCOUNT.

    Here...

    __________________________________________________

    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

    Just a point to note here:   The way that dynamic SQL works, you are going to get MULTIPLE queries and execution plans from the various combinations of parameters.    Some...

    __________________________________________________

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