Forum Replies Created

Viewing 15 posts - 3,136 through 3,150 (of 7,613 total)

  • RE: error message with try part of try catch when cursor updating tables

    Isn't this the third iteration of the same essential q?  Why do you keep re-posting the same q??

    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: Msg 5173

    Jeffrey Williams 3188 - Wednesday, October 3, 2018 3:31 PM

    ScottPletcher - Wednesday, October 3, 2018 3:11 PM

    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: I need help with SQL queries

    I suggest just this.  If that still performs poorly, we'll have to look at the view itself and tune it.


    DECLARE @StartDate date = '01-01-2018'
    ,...

    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: finding duplicates users


    SELECT
        EmployeeId, Forename, Surname, DateOfBirth, leaver, EmployeeStartDate, LeftDate
    FROM (
        SELECT *, ROW_NUMBER() OVER(PARTITION BY EmployeeId
            ORDER...

    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: Msg 5173

    I'm assuming, and hoping, that you copied the files to the new locations rather than moved them (never do that, always copy and retain the originals until the ONLINE works...

    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: Query Performance Improvement

    The only thing I see that could help would be a separate index on just:
    (col1, col2)
    If possible, use compression on the index, at least row but page if...

    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: Automatically avoid error inserting into identity field

    I think you could use an INSTEAD OF INSERT trigger to do that, adding a view if necessary to avoid SQL "compile"/pre-scan issues.  Of course the trigger would apply to...

    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: Table Design - identify one record as base and all others as being multipliers or divisors of base

    I don't follow.
    So there can be multiple rows for Product ABC123.  Why?  To allow changes over time?  Or for diff locations?

    It might be helpful to do this logically,...

    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: Insert records in to table that has primary key identity seed

    If you want to add an IDENTITY column in table1 that is not in table2, you can do this:

    select IDENTITY(int, 1, 1) AS id, *
    into table1...

    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: Query: Get Top 3 Records for multiple Field categories


    SELECT EName, UnitsSold, Category
    FROM (
        SELECT *, ROW_NUMBER() OVER(PARTITION BY Category ORDER BY UnitsSold DESC) AS row_num
        FROM #t
        WHERE...

    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: Change Logs

    You should do at least some normalization here.  I'd say the below is the minimum.  Easiest is a separate row for each column.  Without more normalization, yes, that will result...

    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: UK Date Error - SQL2008

    You could change the date format just for that code:


    DECLARE @dateformat_setting char(3)
    IF OBJECT_ID('tempdb.dbo.#useroptions') IS NOT NULL
      DROP TABLE #useroptions
    CREATE TABLE #useroptions (

    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: Compare Table Contents Procedure

    DinoRS - Tuesday, October 2, 2018 5:55 AM

    francesco.mantovani - Thursday, September 20, 2018 3:17 PM

    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 can we auto increment by 1 from the max ID with an update or an insert into to the same table.

    Sorry, extremely busy at work, didn't finish code before.  Maybe as below?


    INSERT INTO [dbo].[SomeCause] ( SomeID, SomeType, SomeThingElseID, SomeDesc )
    SELECT SC.SomeID, SC.SomeType, SC.SomeThingElseID_New, SC.SomeDesc

    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: Format column as HHH:MM:SS instead of MMM DD YYYY HH:MM (AM/PM)

    If those values truly correspond with your results:
    741:51:59 = Jan 30 1900 11:34PM
    then I'm not sure what you can, as I don't see a clear link between the two...

    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,136 through 3,150 (of 7,613 total)