Forum Replies Created

Viewing 15 posts - 6,391 through 6,405 (of 7,613 total)

  • RE: view points to linked server tables

    No, it's not a good idea. SQL will typically not be able to generate as good a plan for remote tables as it does for local ones.

    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: round down

    You can get the result you need: the specific method depends on specifically what you need to do. If you can provide sample values and the desired results, we...

    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: Time difference

    For anything less than 24 hours, you can do this:

    SELECT

    CONVERT(varchar(8), DATEADD(SECOND, DATEDIFF(SECOND, segstart, segstop), 0), 8)

    FROM (

    SELECT CAST('20130906 09:28:00' AS datetime) AS...

    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 with Output in a Merge Statement

    Just list the column names that are being inserted into the new table; you don't have to supply all columns. For example, see below; naturally your specific column names...

    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???? Query idea???

    SELECT *

    FROM dbo.tablename

    WHERE Customer IN (

    SELECT Customer

    FROM dbo.tablename

    GROUP BY Customer

    HAVING COUNT(DISTINCT Contract) > 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".

  • RE: Updating a Temp Table column with data from another column in same Temp Table (data from previous month)

    UPDATE CurrMonth

    SET [PrevPerc] = PrevMonth.[CurrPerc]

    FROM #Month CurrMonth

    INNER JOIN #Month PrevMonth ON

    PrevMonth.[DEPARTMENT] = CurrMonth.DEPARTMENT AND

    PrevMonth.[YEAR] = CurrMonth.[YEAR] - CASE WHEN CurrMonth.[MONTH] =...

    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: Working with Strings

    I wouldn't use PARSENAME here because of potential side effects, for example, periods (.) in the data or brackets ([]) around a piece of data. The code below should...

    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 Data Capture as a long-term change-tracking solution

    Yeah, it wasn't intended to be used that way, so my guess is it wouldn't work all that well for that. Even performance could become a real issue at...

    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 to Return each field that is Not Null

    Something like this may do it for you:

    SELECT

    tn.ID, tn.Status, tn.Description, tn.[Project Number],

    ColNames.ColName

    FROM dbo.tablename tn

    INNER JOIN (

    SELECT 'FreeText01'...

    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: Clustered Indexes on Identity columns

    Grant Fritchey (9/4/2013)


    ScottPletcher (9/4/2013)


    I admit, this is my pet peeve in physical table design. Identity as clus key is ridiculously over-, and, thus improperly, used. So I 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: Clustered Indexes on Identity columns

    Grant Fritchey (9/4/2013)


    ScottPletcher (9/4/2013)


    Grant Fritchey (9/4/2013)

    Instead I've noticed that you're probably going to have an "identity more likely than not" approach on most systems just because it makes sense.

    I'd disagree...

    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: Clustered Indexes on Identity columns

    Grant Fritchey (9/4/2013)

    Instead I've noticed that you're probably going to have an "identity more likely than not" approach on most systems just because it makes sense.

    I'd disagree even with that;...

    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: Same query, two users, different performance

    Are schema names specified on the tables in the query? If not, what are the default schemas of the two users running the queries?

    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: Clustered Indexes on Identity columns

    @DaveDB:

    You're quite right. There's no genuinely good reason for the "default" clustering key to be an identity column. Many people just do it by rote, without thinking about...

    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 with query to get monthly data

    SELECT

    [Database],

    MAX(CASE WHEN MONTH(ReportDate) = 01 THEN Size END) AS Jan,

    MAX(CASE WHEN MONTH(ReportDate) = 02 THEN Size END) AS...

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