Forum Replies Created

Viewing 15 posts - 721 through 735 (of 1,082 total)

  • RE: How to get total time for each employee

    WOuld this be what you want?

    SELECT

    [empno],

    SUM(DATEDIFF(Month,[startdate],[enddate])) as tot

    FROM test

    GROUP BY [empno]

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: How to get total time for each employee

    Hi again.

    Could you give us an example of what the ouput should be?

    Thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: How to get total time for each employee

    HI there,

    Is this what you looking for?

    SELECT

    s.[empno] ,

    DATEDIFF(minute,s.[startdate],e.[enddate])

    ,[startdate]

    ,[enddate]

    FROM (SELECT MAX(Enddate) as Enddate, [empno] FROM test GROUP BY [empno]) e

    INNER JOIN (SELECT MIN(Startdate) as Startdate , [empno] FROM test GROUP...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Query performance drops when wrapped in stored procedure

    Glad to be of help 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Query performance drops when wrapped in stored procedure

    I'm not 100% sure on this, but I have seen a few people with problems similar to this.

    A lot of the time it is down to something called "Parameter sniffing"...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Need Help In Getting Required Result

    Strangest question I ever saw.

    Why do you even need teh table?

    DECLARE @Loop INT, @Number INT

    DECLARE @Loop2 INT

    SET @Loop = 0

    SET @Loop2 = 3

    WHILE @Loop <= 7

    BEGIN

    ...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Automatic Statistics Maintenance - Good or Bad

    Cool thanks

    They all have Avg page of 1

    So these I don't have to worry about then is that right 🙂

    I must say thats you all, I have learn' more today...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Automatic Statistics Maintenance - Good or Bad

    The table only has 163 rows or so.

    How would I tell how many pages it's using?

    just want to say thanks again for all the help 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Automatic Statistics Maintenance - Good or Bad

    HI All,

    I just ran an index rebuild on a table and it still has a fragmentation of over 90%????

    Anyone know why this is?

    Thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Automatic Statistics Maintenance - Good or Bad

    THis pretty exciting stuff 🙂

    Thanks for all the help everyone.

    Whats cause index fragmentation?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Automatic Statistics Maintenance - Good or Bad

    Last question he he he

    Does anyone have any good procedures for searching an entired DB for Index Fragmentation?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Automatic Statistics Maintenance - Good or Bad

    Thanks for the reply...

    Looks like I might spend my afternoon rebuilding half the indexes on the server 🙁

    as most are 66.66%

    Also is this just simply a matter of manually droping...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: VERY STRANGE QUERY

    Thanks Jack that is great help.

    I'm going start reading up about indexes fragmentation now 😉

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Automatic Statistics Maintenance - Good or Bad

    Grant,

    Do you have any tips/advice on scripts that you mentioned above, that check indexes and fragmentation etc?

    and how often you do this kind of thing on your system.

    I'm just worried...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Automatic Statistics Maintenance - Good or Bad

    HI All,

    I'm new to statistics and all that, but finding it interesting 🙂

    Yesterday on our production system we had a query that ran like a dog however if I put...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life

Viewing 15 posts - 721 through 735 (of 1,082 total)