Forum Replies Created

Viewing 15 posts - 6,121 through 6,135 (of 7,613 total)

  • RE: Query optimization help

    So how on earth are you supposed to properly tune a table when you can't change its indexes?? :w00t:

    Edit: Moved the emoticon after the ??.

    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: using sp_MSforeachdb that will include DB name in the output

    Lowell (4/21/2014)


    this query would be an order of magnitude faster (at least!) for getting row counts per table.

    something like this is what you'd wnat to wrap with sp_msForEachdb:

    ...

    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: Log drive issue

    It depends. If you reduce the log file size and it grows back to the original size again, you've just wasted resources, and re-fragmented the file as well.

    Therefore, unless...

    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: Dedicated SQL Server instance for tempdb performance reasons

    Bouke Bruinsma (4/21/2014)


    A question was brought up about TempDB best practices. There is a lot to be said about this. Not knowing your entire physical hardware platform, keep in mind...

    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 Date Format

    case

    when pwdLastSet0 is null then 'Never'

    when pwdLastSet0 = '0' then 'Must change at next logon'

    ELSE convert(varchar(10), DATEADD(mi,(cast(pwdLastSet0 as bigint) / 600000000) - 157258080

    + DATEDIFF(Minute,GetUTCDate(),GetDate()),0) , 101) + ' '...

    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: using sp_MSforeachdb that will include DB name in the output

    IF OBJECT_ID('tempdb.dbo.#row_counts') IS NOT NULL

    DROP TABLE #row_counts

    CREATE TABLE #row_counts (

    db_name nvarchar(128) NOT NULL,

    table_name nvarchar(128) NOT NULL,

    ...

    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 Date Format

    Maybe this:

    case

    when pwdLastSet0 is null then 'Never'

    when pwdLastSet0 = '0' then 'Must change at next logon'

    ELSE convert(varchar(10), cast (DATEADD(mi,(cast(pwdLastSet0 as bigint) / 600000000) - 157258080

    + DATEDIFF(Minute,GetUTCDate(),GetDate()),0) as varchar(32)), 101)...

    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: Row based log files

    Change Tracking won't do what you've described. You would have to use CDC. Please note that CDC is only available on Enterprise Edition.

    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: Outer Apply within an Outer Apply

    Sqlraider (4/21/2014)


    ScottPletcher (4/18/2014)


    Try this:

    SELECT

    emp.eid, emp.agentid,

    info.emailid,

    mail.EmailAddr, mail.LName, mail.FName

    ...

    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: Outer Apply within an Outer Apply

    Try this:

    SELECT

    emp.eid, emp.agentid,

    info.emailid,

    mail.EmailAddr, mail.LName, mail.FName

    FROM employees...

    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: Data in certain fields in a table needs to be encrypted and later on decrypted to be used in sp. What should be the appropriate data type that can be used so that the same column can hold both the encrypted form and decrypted form of data?

    sql_variant would be a good data type for this.

    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: Random fill.

    You don't want to modify the target table structure, as that will have lots of overhead.

    Does the target table have a unique key column(s)? If not, can you add...

    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: Select Only Rows with Alphabetical Character in Column

    Jeff Moden (4/17/2014)


    ScottPletcher (4/17/2014)


    WHERE

    column_name LIKE '[a-z]%'

    That won't reject strings like '1.62073e+015'

    It won't?? That string doesn't look like it starts with a letter to me ......

    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 handle this

    DECLARE @parameter int

    SET @parameter = 2 --NULL=ALL; spec. value = that value

    SELECT

    col1ID,

    CASE WHEN COUNT(DISTINCT Col2ID) = 1 AND

    ...

    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: Selecting Data by Date for last five days AND avoiding weekend dates

    I think this query will give you what you need in separate rows. If so, let us know, and we can pivot it to a single row.

    DECLARE @control_date datetime

    SET...

    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 - 6,121 through 6,135 (of 7,613 total)