Forum Replies Created

Viewing 15 posts - 3,691 through 3,705 (of 7,613 total)

  • RE: Trying to convert a int @variable to a varchar @variable with leading zero.

    I certainly agree that the overhead of a variable isn't needed.

    But tThe RIGHT function is going to implicitly convert the value to varchar anyway, so I would stick...

    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: Trigger after update not working when updating 2 or more rows


    ALTER TRIGGER [dbo].[xxatr_slauf_AufartChangeU]
    ON [dbo].[XXASLAuf]
    AFTER UPDATE
    AS
    SET NOCOUNT ON;
    IF UPDATE(aufart)
    BEGIN
      DECLARE @aufintnr VARCHAR(8000)
      SET @aufintnr = ''
      SELECT @aufintnr...

    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: Quck TSQL question with regards to sys.master_files

    Best practice is to explicitly specify the table name/alias for every column in a query.  Otherwise, if one of the tables adds a column with the same name, the same...

    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: Move user database

    Other issues:
    1) if there's an error in a db file (such as would show up in a DBCC CHECKDB), it won't reattach
    2) during a reattach, the file gets...

    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: Date format check


    SELECT *
    FROM #Date
    WHERE ISDATE(DateString) = 0 OR
      DateString NOT LIKE '__[/.-]__[/.-]____' OR
      SUBSTRING(DateString, 3, 1) <> SUBSTRING(DateString, 6, 1)

    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: Rounding to the nearest 15 seconds

    Jeff Moden - Monday, November 13, 2017 8:15 AM

    If both simplicity and performance are important AND the datetimes will always be >...

    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: Move user database

    It's no longer needed for moving files around on the same instance.  Instead you can update the master catalog with the file locations, take the db offline, move the files,...

    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 Structure of Monthly Data

    Phil Parkin - Thursday, November 9, 2017 11:08 AM

    ScottPletcher - Thursday, November 9, 2017 10:30 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: Table Structure of Monthly Data

    You don't need an ID in this table at all (at least on what's known so far); in fact, as so often is the case, it corrupts what would be...

    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: use clause

    It may depend on specifically what you're trying to do.

    For example, if you just want to execute a stored proc in the context of that db, you can...

    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: Date Ranges - Simple, but seemingly impossible

    ChrisM@home - Tuesday, November 7, 2017 2:07 PM

    ScottPletcher - Tuesday, November 7, 2017 2:02 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: Date Ranges - Simple, but seemingly impossible

    Based on what's been show so far, I believe the best clustering key for this table would be:
    ( ProductCode, ValidFrom, ValidTo )
    rather than just ValidFrom and ValidTo, assuming...

    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: Understanding of Unique Index

    Yeah, your "DBAs" are dead wrong, and don't seem to understand indexing at even a basic level, which is a tough situation for you (and all the dbs they control!).

    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 two tables with complex derived keys that don't match

    It seems as if you'd be scanning both tables anyway, since you're reading all the master and details (?).

    Maybe just?:

    FROM Details d
    INNER JOIN Master m...

    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: Rank a large table

    If you know that all rows in table1 come before rows in table2, you can go ahead and assign the ranking as part of the load of the 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".

Viewing 15 posts - 3,691 through 3,705 (of 7,613 total)