Forum Replies Created

Viewing 15 posts - 6,331 through 6,345 (of 7,619 total)

  • RE: Best Way to Create Multiple Columns from A Single Column

    You don't have to use two ROW_NUMBER() clauses/entries:

    ;WITH detail AS (

    SELECT *, ROW_NUMBER() OVER (ORDER BY id) AS row_num

    FROM #test

    )

    SELECT

    ...

    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: Pivot All Columns

    Luis Cazares (11/20/2013)


    As all values will show in a single column, the first value will determine the column data type.

    I don't think that's right. I think SQL uses data...

    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 display totals grand total in t-sql

    first a 800

    first a 200

    first a 1000

    TOTAL 2000

    first b 100

    first b 200

    TOTAL 300

    second a 400

    TOTAL 700

    second b 400

    TOTAL 1100

    GRANDTOTAL 5100

    I don't understand the totaling logic you want.

    "TOTAL 700"?? 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: Is point-in-time possible after restore

    I think so, but I couldn't swear to it. I think the differential bitmaps are restored as-is with the db, and not reset, but I'm not 100% sure. ...

    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 point-in-time possible after restore

    Donald Sawford (11/18/2013)

    I know that a full backup should be run immediately after a restoration

    That shouldn't really be necessary, assuming you still have the backups you used to do 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: Most efficient way to get a single unique combined record for distributed information corresponding to same ID

    MAX(age) seems safe enough -- no one gets any younger :-).

    Combining MIN(name) and MAX(name) would allow one name change ... that should handle everyone, right!?

    /*

    insert into #temp(id,name)

    select 2,'Jane Single'

    insert into...

    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: What master database objects does BCP use

    No, but I do know that you're never supposed to remove the Guest account from master. Basically SQL requires it. Put it back and try again before making...

    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: Sql Query Help

    Something like below. If the LAST_NAME and FIRST_NAME are in the same table (shouldn't be, from a design standpoint), then you can remove the outer query and join 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: CASE Statment Help

    DarthBurrito (11/13/2013)

    I will get a false 1 since the modifieddate will always be larger than the ClosedField that has a NULL.

    How can I tell it when the DateClosed field 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: calculating a date in the future

    a20213 (11/7/2013)


    Perfect Mr. Scott.

    Indeed, the same day of week has to be the same, mandatory.

    PS: When you say "So, adding 6 mos gives a date of '2014-11-05', which becomes '2014-11-11',...

    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: calculating a date in the future

    None of that is necessary: a simple calculation can give you the future date you need.

    The code below assumes you want a future matching-day date on or after the months-added...

    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: Compact, fully indexed, archive database

    You should also consider using option "SORT_IN_TEMPDB = ON" in the rebuild. That should give you about the same space gains without having to use a separate fg within...

    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: Index/table rebuild

    1. The only way to rebuild heaps is to add a clustered index; you can then drop it. Since, however, adding or dropping a clus index requires rebuilds...

    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: Pseudo PIVOT query

    SELECT

    MatchID, KeyCode,

    CASE KeyCode

    WHEN 'MTDT' THEN CONVERT(varchar(100), MatchDate, 101)

    ...

    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 can I select values where first 2 characters are non numeric and last character is 1

    Safer might be:

    WHERE

    FtgNr NOT LIKE '[^0-9][^0-9]%1'

    Unless you really want "alphabetic" rather than "non-numeric" as originally stated. Spaces, underscores, periods, etc., would fail this test but pass the other one...

    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,331 through 6,345 (of 7,619 total)