Forum Replies Created

Viewing 15 posts - 1,981 through 1,995 (of 7,613 total)

  • Reply To: How to convert YYYY_WW in order to compare with a datetime column

    Or take the month difference and divide by 12.

    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".

  • Reply To: Load Monitor

    Create a job to check on the data.  Even though it will check the last hour, you could schedule it to run as often as you wanted to check:

    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".

  • Reply To: How to convert YYYY_WW in order to compare with a datetime column

    My first thought would be to simply take the difference of the year.  Do you want to adjust based on the month as well as the year?


    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".

  • Reply To: Query is hanging

    I don't see any view defs.  Instead of attaching them, you can post them using the "insert/edit code sample" button when you go to post a Reply.

    If I'm overlooked them...

    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".

  • Reply To: Rebuilding and Reorganizing Indexes

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    If you have some indexes that have woefully low (less than 80% average percent of page fullness [page density]), then rebuild (NOT reorganize) them at 82%...

    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".

  • Reply To: Rebuilding and Reorganizing Indexes

    Jeff Moden wrote:

    If you have some indexes that have woefully low (less than 80% average percent of page fullness [page density]), then rebuild (NOT reorganize) them at 82% to recover 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".

  • Reply To: Trying to Extract customer Transacted in two unique merchants

     

    SELECT a.cardnumber, Count(*), Sum(AMT) 
    from transactions a
    where Merchant like '%Google%' or Merchant like '%Microsoft%'
    group by a.cardnumber
    having max(case when Merchant like '%Google%' then 1 else 0 end) =...

    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".

  • Reply To: query filter

    here the fieldName 'Status' is 'On' AND filedName 'Subs' isn't 'No' ... only mach 1 would be returned

    But for mach 1, the value for Subs is 'No' in your sample...

    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".

  • Reply To: Using AVG but need to ROUND UP

    If you want round up the avg to whole seconds, then you can use CEILING.  If you want to round to a certain number of decimal places, use ROUND.  In...

    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".

  • Reply To: Query is hanging

    Melanie Peterson wrote:

    Good observations. The view, like this query, is a mess. It joins 7 tables, including one in a database on another server with a different collation, and another view....

    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".

  • Reply To: Query is hanging

    Can you post the query for the view being referenced?  At least I'm assuming that "vwRequests" is a view.  I can't tell what indexes might help this query without seeing...

    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".

  • Reply To: Decimal places

    cast(

    case f.HAI

    when 'A' then (isnull(f.NUM,0)/f.DEN) *10000.00

    when 'B' then (isnull(f.NUM,0)/f.den) *1000.00

    when 'C' then (isnull(f.NUM,0)/f.den) *1000.00

    when 'D' then (isnull(f.NUM,0)/f.den) *1000.00

    when 'E' then (f.NUM/f.den) *100.00

    else 0.00

    end as decimal(9, 2)) as 'Rate'

    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".

  • Reply To: T-SQL Query select with a heap table without join

    If you're joining to the table, and it currently has no indexes at all, then create a clustered index on the WHERE columns and/or JOIN column(s).

    To give you anything more...

    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".

  • Reply To: is value is contained in column - new column

    Please be aware that this is forum for SQL Server dbms.  Your code is obviously for a different dbms.  You might get a better response if you post on a...

    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".

  • Reply To: question on Index Rebuilds

    Jeffrey Williams wrote:

    ScottPletcher wrote:

    Yes, sorry, as I stated in passing earlier, what I meant was that you "can't" in practice even if you can in theory because it takes so long...

    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 - 1,981 through 1,995 (of 7,613 total)