Forum Replies Created

Viewing 15 posts - 16 through 30 (of 114 total)

  • RE: Move row value into column

    select ..., max(CASE

    WHEN m.Period_Abbreviation='EAM'

    AND m.Att_Code IN ('VU','UA','A')

    THEN 'U'

    WHEN m.Period_Abbreviation='EAM'

    AND m.Att_Code NOT IN ('VU','UA','A')

    THEN 'E'

    ELSE NULL

    END),

    ...

    FROM Ps_Attendance_Meeting m

    right join Students S on s.id = m.Studentid

    WHERE M.Presence_Status_Cd ='Absent'

    AND M.Period_Abbreviation IN ('EAM','EPM')

    GROUP BY...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Move row value into column

    FROM Ps_Attendance_Meeting Am

    Students S

    WHERE M.Presence_Status_Cd ='Absent'

    AND M.Period_Abbreviation IN ('EAM','EPM')



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Pass semicolon deliminated parameter to stored procedure

    In the parameters to patindex, you are creating a wildcard that looks for the first character of your delimited string, (or the last character) but what you want is to...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Problem with update syntax

    We will need sample data in order to tell you exactly what the problem is... It looks like your join is not doing what you expect it is.

    Said another...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Help with Deadlock

    You might try just adding the columns GasSiteID and DroppedProd to the orderDetails.OrderStatus index.

    I agree though, it looks like there's a lot of improvement that could be made in those...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Has anybody constructed dynamic SQL by storing SQL in fields in tables?

    Back to the question of the OP:

    I have used this technique (or part of it), and as a solution to precisely the problems mentioned by the first couple of answerers...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: subquery recursive?

    I'm afraid you'll have to post more details in order for me to understand what you're looking for. For a start, your sample code does not match your sample...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: please interpret sql clause

    Overall, R.P.R. got the overall answer correct, however I felt compelled to add a minor correction:

    The two versions of the select max statement R.P.R. included are equivalent.

    The way to write...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Has the culture of this web site changed?

    In defense of the people who haven't read the BOL, It can be exceedingly hard to figure out where to find something if you're not familiar with the organization (or...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: T-SQL Newbie needs help

    If an account was active every other year for the last ten years instead of being fully active for the last 5 years, I believe your code would still...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Want a solution on cursor problem

    I agree with John, this is a task better left to the display layer.

    That said, in 2005 you can use the row_number to check if you have the first row...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Store Procedure not returning any data when connected to SSRS

    Your problem is that <blank> is not the same as <null>

    When you're executing from SSRS, I believe it's passing parameter values of '' instead of just not passing the parameter,...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: Bad performance of a query

    Yes, please update the stats with a full scan, so that we can rule out bad stats as a cause for bad performance.

    After you do that, post the updated code...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: T-SQL Newbie needs help

    I think you want

    Select ActName, PName

    FROM SalesDetailsCTE

    GROUP BY ActName, PName

    HAVING COUNT(DISTINCT DATEPART(yyyy, SoDate)) = 5

    (this says for each customer and product, show me the customers that have bought...



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

  • RE: The maximum key length is 900 bytes

    Post your table definition, including the index create statements.



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'

Viewing 15 posts - 16 through 30 (of 114 total)