Forum Replies Created

Viewing 15 posts - 4,231 through 4,245 (of 7,619 total)

  • RE: remove duplicate values in a view , without affecting main tables

    Here's a quick example of what Drew's talking about. Naturally adjust the ORDER BY clause as needed to get exactly the output you want:

    IF OBJECT_ID('tempdb.dbo.#StudentTransportOrder') 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: joining multiple tables without a join

    Given that there is no clustered index now, you might as well clus to match this query, something like below. If you have DATA_COMPRESSION available, be sure to use...

    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: help needed with sql update

    I think CROSS APPLY (or OUTER APPLY if you want NULL if no match is found) will do it, but of course I can't test it without useable data.

    Btw, if...

    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: Proper Storage and Handling of Personal Names

    Robert Domitz (8/4/2016)

    3. Is "von Helsing" the same as "VONHELSING" or just "HELSING"? In the latter case, the originating system sliced off the "von" as a middle name!

    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: Proper Storage and Handling of Personal Names

    You certainly don't want to just store the entire name in one long, indistinguishable string. Trying to accurately parse that out later is virtually impossible.

    As to the different rules/formats,...

    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 make optimizer choose an Index Seek when I have ISNULL() FUNCTION on my column referenced in WHERE condition?

    1) Don't use ISNULL, you don't need it there anyway:

    select c1,c2,c3 From numbers

    where c3 <> 'CP-961080'

    2) A nonclustered index lookup would be very inefficient here, although you might be able...

    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: Why does log file growth default to limited?

    I believe that SQL itself has an internal limit on how large of a log file it can use, so the max log size is set to that. No...

    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 write tsql for report

    Probably the easiest way is to use derived tables within a main query, like below, assuming that each derive table returns only a single row:

    SELECT q1.*, q2.*, q3.* --, ...

    FROM...

    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: The effect of nolock on the sort order of a view

    In theory, it's also possible that you could get any 1,000 rows that are already present in buffers and thus don't require physical I/O. Without an ORDER BY, 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: Very generic question

    Some things to check, roughly in order:

    1) Verify that a valid and reasonable "max memory" value is set in SQL Server.

    2) Verify that IFI is turned on in Windows 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: Flattening Nested Views

    I can't imagine any tool that would be able to do that, given that each view level could be arbitrarily complex.

    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: Better method for computed column?

    mike 57299 (7/25/2016)


    I use the index for other queries as well. Can I create a new filtered index? How do I make the function use the new index?...

    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: Better method for computed column?

    I agree overall with Alan's comments. If you're willing to convert existing code/queries, also look into an itvf to do the computation.

    However, for now, let's tune what you have....

    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: Reducing the hash match inner join cost

    Jeff Moden (7/21/2016)


    ScottPletcher (7/21/2016)


    Jeff Moden (7/20/2016)


    ScottPletcher (7/20/2016)


    If the "isactive" flag is significant, i.e. a significant number of rows are actually inactive, then cluster first on it. If not, get...

    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: Reducing the hash match inner join cost

    Jeff Moden (7/20/2016)


    ScottPletcher (7/20/2016)


    If the "isactive" flag is significant, i.e. a significant number of rows are actually inactive, then cluster first on it. If not, get rid of it....

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