Forum Replies Created

Viewing 15 posts - 4,891 through 4,905 (of 7,619 total)

  • RE: Metrics Table or Performance Tuning

    ChrisM@Work (8/21/2015)

    The inner select can be accelerated with this index:

    CREATE INDEX ix_Helper ON [cts].[exception_Main]

    (productArea, reportable, reportYear, reportMonth, queueID)

    INCLUDE (volume, cost, exceptionDateTime)

    But with the best clustered index now on...

    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: Metrics Table or Performance Tuning

    Interesting. Edit: The only reason that particular join should be slow is the large number of lookups, since the map_exception table only has a few hundred rows. End-Edit.

    At any...

    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: return the code that sp_MSforeachtable would produce

    drew.allen (8/19/2015)


    ScottPletcher (8/19/2015)

    Be careful. The ? is replaced with a fully delimited schema and table, such as:

    [dbo].[table1]

    I didn't realize that was the case. In that case my query...

    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: return the code that sp_MSforeachtable would produce

    Excellent point about the underscore, it definitely needs bracketed.

    Be careful. The ? is replaced with a fully delimited schema and table, such as:

    [dbo].[table1]

    Thus, a comparison like:

    IF ''?'' LIKE ''%[_]st''

    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: Account Number Transformation

    CREATE TABLE #AccountNum_Custom_Handling (

    AccountNum varchar(50) NOT NULL PRIMARY KEY,

    action_to_take char(1) NOT NULL

    CHECK(action_to_take IN ('D',...

    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: return the code that sp_MSforeachtable would produce

    You can use a PRINT to just print the command, then remove the print and the extra quotes when ready to run the commands.

    SET QUOTED_IDENTIFIER OFF; --this is implied by...

    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: Is is possible to 'restore' the database from the 'raw' .mdf and .ldf files of the old computer to the new computer / database

    SQL expert or not, I'd advise you to use a CREATE DATABASE ... FOR ATTACH command rather than using a gui. That way you have a record of exactly...

    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: Metrics Table or Performance Tuning

    This is so typical of these types of situations. As usual, there is a vastly better clustering key available than identity.

    The (first) clustering key for this table should 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: SET TABLE VARIABLE FROM FUNCTION CALL

    If you need to reference that table in multiple places, just load it into a temp table, global temp table or even a regular table in the tempdb db. ...

    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: Need Help with Business Logic in a Stored Procedure

    redmittens7 (8/17/2015)

    [dbo].[OrderItems]

    [ItemID] INT IDENTITY(1,1) PRIMARY KEY NOT NULL,

    [OrderID] INT PRIMARY KEY NOT NULL,

    It's...

    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: "Lateral" migration of a 2008R2 box

    You could either restore the master db --or-- bring down SQL, copy the original master files over the new master files, and start SQL normally. You'll see a lot...

    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: Restore database from a compressed backup (data not compressed) to compress the data at restore time

    Large data files are typically not an issue, assuming IFI is on. But the log file must always be preformatted. If possible, you'll want to reduce the log...

    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: Please help with code improvements

    Edit: An inline table-valued function is much more efficient, and your code is easily converted to one, as below:

    CREATE FUNCTION [dbo].[fn_GetDupsFeeds](

    @ContractNbr int,

    @DOCId int,

    @FeedTime int,

    @ServiceTypeId varchar(10),

    @FlightStart smalldatetime,

    @FlightEnd smalldatetime = null,

    @IsMonday...

    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

    - sms takes a good 3-5 minutes to open before it even let's me choose a database to connect to

    Also make sure the msdb db is not overloaded with, say,...

    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: LIKE, [ ] and empty string

    WHEREtbl.Body + '.' LIKE '%[^a-z]'+pm.OldFirstName+'[., ]%'

    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,891 through 4,905 (of 7,619 total)