Forum Replies Created

Viewing 15 posts - 4,441 through 4,455 (of 7,619 total)

  • RE: TVF suddenly slow

    Rather than being "stuck" on tuning, why not take this as an opportunity to possibly tune the query overall and post the code? Perhaps it can be reduced below...

    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 column smallint to int 300 million records

    If you create a new column, and copy existing data to that column, you don't have to UPDATE every row in a single transaction. And you don't have 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: Change column smallint to int 300 million records

    So the entire 460GB is in the main part of the table, none in overflow space? Often with a row that wide you'd be able to offload a decent...

    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: Convert date to MMDDYYYY

    Yeah, should be good, except that I'd use varchar instead of char so that you don't have trailing spaces after the /s are replaced.

    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 column smallint to int 300 million records

    Sergiy (2/9/2016)


    ScottPletcher (2/9/2016)


    Absurd to make a blanket claim about "every page". Increasing from a smallint to a full int requires only 4 extra bytes per row (as I understand...

    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: parallel execution of CTAS statements

    That sounds like Oracle not SQL Server. SS doesn't have CTAS syntax.

    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: Extract text from middle of string

    Maybe code below, if you're looking for a date:

    SELECT CASE WHEN PATINDEX('%[_]20[0-9][0-9][0-1][0-9][0-3][0-9][_]%', string) = 0

    THEN ''

    ...

    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: Filter sp_msforeachdb @myvariable

    Most flexible is probably to put the dbs names/LIKE patterns into a temp table and process only names that have a match in that table:

    IF OBJECT_ID('tempdb.dbo.#databases') IS 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: Query on Using DB Snapshots

    Perry Whittle (2/9/2016)


    ScottPletcher (2/9/2016)


    Perry Whittle (2/9/2016)


    Luis Cazares (2/8/2016)


    DB Snapshots use the database as the main source of data and only store pages that get modified. That means that querying against...

    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 on Using DB Snapshots

    Perry Whittle (2/9/2016)


    Luis Cazares (2/8/2016)


    DB Snapshots use the database as the main source of data and only store pages that get modified. That means that querying against the snapshot 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".

  • RE: Change column smallint to int 300 million records

    Sergiy (2/8/2016)


    Igor Micev (2/5/2016)


    This is not a good thinking. What if you have many schema bound objects with that table?

    The advise from ScottPletcher is just fine. Changing from smallint 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: Query on Using DB Snapshots

    Snapshot won't help you, in fact it will very likely make performance worse.

    If you only need to refresh the reporting view once a day, back up the original db 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: Building DATETIME from two strings

    Interesting. The code below should work fine. What error are you getting? Are you sure that time is always formatted correctly?

    SELECT CAST(LEFT([Date],8)+' '+Time_on AS datetime)

    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 column smallint to int 300 million records

    The command to change an existing data type is simple enough to issue:

    ALTER TABLE dbo.table_name ALTER COLUMN <new_data_type> NULL --or "NOT NULL" of course

    --always explicitly specify NULL or 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: How do I concatenate Month and Day to get date mm/dd format

    Since using character data tends to slow things down, maybe this:

    SELECT DATEADD(DAY, b.Fiscal_Year_End_Day_Nbr - 1,

    DATEADD(MONTH, b.Fiscal_Year_End_Month_Nbr - 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".

Viewing 15 posts - 4,441 through 4,455 (of 7,619 total)