Forum Replies Created

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

  • 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".

  • RE: Field Has No Value But Is Not NULL Or Empty

    Most likely rather than a blank the first char in the column is some non-displayable character, such as a tab (char(9)), cr (char(13)), or line feed (char(10)).

    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: DB Infrastructure changes, suggestions wanted

    The single biggest SQL tuning payback, after any infrastructure issues are addressed, is making sure you have the best clustered index on every significant table. Hint: This is most...

    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

    If you (almost) always process data by month (or other date range(s) too) then cluster the table on the related date column. You should far less performance issues then.

    Edit:...

    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: While loop to replace text - how to re-write to use set processing

    FridayNightGiant (8/14/2015)


    ScottPletcher (8/12/2015)


    Here's a method without an external function, just out of curiosity mostly about how it would perform vs. other methods. It uses a "standard" tally 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".

  • RE: While loop to replace text - how to re-write to use set processing

    Here's a method without an external function, just out of curiosity mostly about how it would perform vs. other methods. It uses a "standard" tally table. This method...

    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 typeof calculated fields

    By the way, you should change the WHERE clause to make it "sargable":

    ...

    WHERE SamplingDate >= '20150101' AND SamplingDate < '20160101'

    ...

    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,613 total)