Forum Replies Created

Viewing 15 posts - 5,326 through 5,340 (of 7,613 total)

  • RE: Find patients with age 6 months to 5 years

    Luis Cazares (3/3/2015)


    Do you mean at the date of the appointment?

    SELECT *

    FROM TEST

    WHERE DOB BETWEEN DATEADD(YYYY, -5, ApptDt2) AND DATEADD(MM, -6, ApptDt2)

    Wouldn't you actually need - 6 years + 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: query question, possible subquery?

    I assume you replaced the '...' with your own columns :-).

    What specific error are you getting?

    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: Database Snapshot questions

    Yes, you will query back to the original db for the unchanged pages. I confirmed this using BOL as well; from BOL:

    "If the page has not yet been updated...

    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 question, possible subquery?

    You really should leave the columns separate in the other table as well, but here's how to do the join with the combined column:

    SELECT ...

    FROM table1 t1

    INNER JOIN table2 t2...

    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: Premature casting on 0 rows insert

    TomThomson (3/2/2015)


    ScottPletcher (3/2/2015)


    Codd was working for IBM at the time, and IBM asked him to do it. To be fair, a lot of it was not just "ill-conceived". ...

    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: Premature casting on 0 rows insert

    DonlSimpson (3/2/2015)


    TomThomson (3/1/2015)


    siggemannen (2/28/2015)


    Hello,

    I have encountered some weird behaviour. Code that has been working for "eternities" suddenly started to fail.

    Alas, i couldn't recreate it on any other machines.

    I'm afraid 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: Date manipulation and CASE statements

    To keep the optimizer's task straightforward, I would set variables to the desired and end date, patterning the code like this:

    --set local variables for start and end date

    DECLARE @start_date datetime

    DECLARE...

    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 backup cause trigger to fire?

    Btw, trigger coding should concentrate on efficiency, not "step by step" coding, something like below. In this case, the code below is probably easier to follow as well.

    ALTER TRIGGER...

    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: Autogrow configuration keeps reverting

    Check the model db. Maybe the db is being dropped and restored, and thus maybe picking up the values from the model db.

    I recommend avoiding % growth amounts anyway,...

    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 Data type and size of the each row!!!!!!

    As I noted earlier, once you have data loaded you can do:

    SELECT *

    FROM sys.dm_db_index_physical_stats(DB_ID(),OBJECT_ID('<your_table_name>'),NULL,NULL,'DETAILED')

    And SQL will give you the average and max rows lengths for the data you have.

    My script...

    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: Changing the clustered index

    Jeff Moden (2/27/2015)


    ScottPletcher (2/27/2015)


    Jeff Moden (2/27/2015)


    It's also a bit odd for me to have you tell me not to be so concerned with the speed of imports when you, yourself,...

    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: Changing the clustered index

    Jeff Moden (2/27/2015)


    It's also a bit odd for me to have you tell me not to be so concerned with the speed of imports when you, yourself, have posted just...

    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: Changing the clustered index

    Jeff Moden (2/27/2015)


    ScottPletcher (2/27/2015)


    Jeff Moden (2/27/2015)


    ScottPletcher (2/27/2015)


    Jeff Moden (2/27/2015)


    ScottPletcher (2/27/2015)


    Your clustered index key(s) doesn't(don't) have to be unique by itself(themselves); SQL will take care of that if it needs 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: Changing the clustered index

    Jeff Moden (2/27/2015)


    ScottPletcher (2/27/2015)


    Jeff Moden (2/27/2015)


    ScottPletcher (2/27/2015)


    Your clustered index key(s) doesn't(don't) have to be unique by itself(themselves); SQL will take care of that if it needs to.

    ... at possibly quite...

    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: Changing the clustered index

    Jeff Moden (2/27/2015)


    ScottPletcher (2/27/2015)


    Your clustered index key(s) doesn't(don't) have to be unique by itself(themselves); SQL will take care of that if it needs to.

    ... at possibly quite some cost 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".

Viewing 15 posts - 5,326 through 5,340 (of 7,613 total)