Forum Replies Created

Viewing 15 posts - 3,451 through 3,465 (of 7,613 total)

  • RE: Join on field of varying length

    daniness - Wednesday, April 18, 2018 1:59 PM

    Hi Scott,
    Thanks for your reply. I'm not following your code. In this portion:

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: How to use Cast & Convert

    Use CAST (it's ANSI-standard), and CAST the final result as well, if you want a specific size of result:

    CAST( CAST( SUM(Principal1) AS DECIMAL(5,2) ) + CAST ( SUM(BankInterest) AS DECIMAL(5,2)...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Join on field of varying length

    daniness - Wednesday, April 18, 2018 10:24 AM

    ScottPletcher - Wednesday, April 18, 2018 9:17 AM

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Determining the Years, Months, Weeks and Days between two dates

    See if this gives you what you need -- it should at least be very close.  Btw, T-SQL isn't like C#, you don't need separate statements for every calc.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Transferring data between tables

    For that type of table definition, I'd suggest forcing all LOB columns completely out of the main table space (since SQL doesn't allow you to customize column-by-column).  That should avoid...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Join on field of varying length

    I'd use CROSS APPLYs to determine the lengths (this helps keeps the other code "cleaner" by pushing calcs/computations into CROSS APPLYs).  For example:


    SELECT PCMRetrievalCode, LenOfSchemaId,...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Get all index definitions from all databases and all tables

    I still don't understand why you need the index in string format to determine that.  It's actually easier to accurately compare the meta-data rather than a string definition (where noncritical...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Splitting a string after the first space after the 10th character?


    SELECT string, LEFT(string, split_byte - 1) AS string1,
        SUBSTRING(string, split_byte + 1, 8000) AS string2
    FROM (
      VALUES('Apple is Red and Grapes are Purple'),

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Question on Backups

    I'm going to label each q so others can comment without having to repeat the full q:

    A1) transaction log back up verses a full back up? 
    A tran...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Campare the 2 highest transaction

    cfm - Friday, April 13, 2018 11:50 AM

    ScottPletcher - Friday, April 13, 2018 11:18 AM

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Performance of Select Into vs Insert

    Would it result in better performance is I created the table and used INSERT instead of Select Into? 

    For that INSERT, no.  In fact, SELECT ... INTO dbo.new_table...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Campare the 2 highest transaction

    cfm - Friday, April 13, 2018 10:22 AM

    ScottPletcher - Friday, April 13, 2018 8:46 AM

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Campare the 2 highest transaction


    DECLARE @start_date date
    DECLARE @end_date date
    SET @start_date = DATEADD(YEAR, -1, GETDATE())
    SET @end_date = GETDATE()

    SELECT
      AccountNumber,
      CASE WHEN MAX(CASE WHEN row_num =...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: datetime conversion oddity

    Btw, just based on the pattern of code in your OP, it looks like you're doing a BETWEEN range on a datetime.

    Put simply, DON'T do that, ever.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Trying to reduce RID Lookups

    andrew 67979 - Thursday, April 12, 2018 9:11 AM

    Ref point 1B is this what you mean ?

    Yes, that is...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 15 posts - 3,451 through 3,465 (of 7,613 total)