Forum Replies Created

Viewing 15 posts - 4,141 through 4,155 (of 7,613 total)

  • RE: Looking to update old code

    Eric M Russell (9/23/2016)

    Regardless of SQL Server version, performance optimization should start by looking at execution plans.

    Not necessarily. If the best clustered indexes are not already in place, you...

    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 verify duplicate email used by more people

    CREATE TABLE #temp1_dup_emails (email varchar(20) PRIMARY KEY);

    Insert into #temp1_dup_emails

    SELECT CASE WHEN which_email = 1 THEN email1 ELSE email2 END AS email

    FROM #temp1

    CROSS JOIN (

    VALUES(1),(2)

    ) AS which_email(which_email)

    GROUP...

    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: Cleaning up "rotten" tables - need help with code

    Personally I wouldn't rely on sys.partitions to gauge whether a table is completely empty or not. Maybe just me. Just out of curiosity, what if a table load...

    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 close a file to move to another disk

    If it's not a system db, you can move db files by specifying a new location for the file, setting the db offline, physically moving the file(s), and finally setting...

    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: [dbo].[sysusers] column issue

    No. But maybe you could create your own view with a similar name -- such as dbo.sysusers2 -- and change your code to use the view name?

    create view dbo.sysusers2...

    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: Cleaning up "rotten" tables - need help with code

    I view it differently, since I prefer a code-based solution to a gui-based solution.

    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: Cleaning up "rotten" tables - need help with code

    Here's the code you're not looking for 😉

    /* drop empty "MyTable%" tables */

    DECLARE @exec_sql bit

    DECLARE @print_sql bit

    DECLARE @sql nvarchar(4000)

    DECLARE @table_has_row bit

    DECLARE @table_name nvarchar(128)

    SET @exec_sql = 0

    SET @print_sql = 1

    DECLARE cursor_tables...

    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: When Is an Execution Plan Cached?

    Also, be aware that some plans are never cached at all, for example, a trivial plan to satisfy "select * from table_name".

    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 convert navarchar to datetime

    Sergiy (9/21/2016)


    Be aware that conversion of varchars to datetimes by style "120" is locale dependent.

    On different server settings you may get different results:

    SET DATEFORMAT DMY

    SELECT CONVERT(VARCHAR(20), CONVERT(datetime,CAST('2016-08-10 05:29:27' as datetime),112),...

    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 convert navarchar to datetime

    You can use CONVERT to format 120 to do that:

    select '='+senddate+'=' AS [original char format], convert(varchar(19), SendDate, 120) AS [yyyy-mm-dd hh:mm:ss]

    from (

    select convert(nvarchar(4000), GETDATE(), 121) as...

    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: Indexing strategy

    Alexander Suprun (9/16/2016)


    I think you overstate the importance of the clustered index, especially in this case. Clustered index doesn't really matter too much here. The one you suggested will 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: How do I get a substring out from a string?

    I also don't see a need to split the entire string in this case, since you all want to extract is the CN= name.

    SELECT

    string,

    ...

    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: CREATE INDEX statement rollback doesn't behave as expected

    Alexander Suprun (9/19/2016)


    ScottPletcher (9/1/2016)


    Rollbacks very often take more time than the initial modification. They are only very quick if all the pages are still in memory.

    Since when SQL Server...

    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: CREATE INDEX statement rollback doesn't behave as expected

    You might need to do the "script out existing nonclustered indexes, create a new table with identical structure -- except with the clus index (only) in place, of course --...

    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: Indexing strategy

    The single most important performance factor for most tables is how they are clustered. You may add non-clustered indexes, typically covering indexes, but the best clustering is the big...

    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 - 4,141 through 4,155 (of 7,613 total)