Tuesday, March 19, 2013

[SQL Server] How can I change the value for Colunm X to 0 where Column Y is '99' in my Query while leaving the actual value as is?

[SQL Server] How can I change the value for Colunm X to 0 where Column Y is '99' in my Query while leaving the actual value as is?


How can I change the value for Colunm X to 0 where Column Y is '99' in my Query while leaving the actual value as is?

Posted: 19 Mar 2013 08:44 AM PDT

I'm still pretty new to SQL and any help would be appreciated. I'm using the following statement:SELECT EMPL_ID,PAY_TYPE_ID,SUM(LABOR_HRS) AS 'HOURS',SUM(LABOR_COST) AS 'Labor Cost'FROM LABORWhere TIMESHEET_DATE >= DATEADD(day, (DATEDIFF (day, '19800104', CURRENT_TIMESTAMP) / 7) * 7, '19800104') -6AND TIMESHEET_DATE <= DATEADD(day, (DATEDIFF (day, '19800104', CURRENT_TIMESTAMP) / 7) * 7, '19800104')GROUP BY PAY_TYPE_ID, EMPL_IDWhich returns the following values below:EMPL_ID001002003PAY_TYPE_IDAB99HOURS404040Labor Cost40095052How can I change the labor cost for any pay type using '99' to return 0, while leaving the actual value as is?For example, I would like it to be something like this... EMPL_ID001002003PAY_TYPE_IDAB99HOURS404040Labor Cost4009500I've tried using CASE previously without any luck (feeling pretty ignorant at this point).

New Database Request Form

Posted: 15 Sep 2010 04:01 AM PDT

Hi guys,Just wondering if anyone has created a new SQL Server Database Request Form? What I'm looking for is a template or form to give to Project Managers in the early stages of a project as soon as they determine that they will be needing a new SQL Server Database or installation.Thanks,Jody

Creating Email "Alerts" based on reporting

Posted: 19 Mar 2013 12:13 AM PDT

Please help a newbie figure out what is possible.I have created a set of color-coded "heat maps" based on server performance. Essentially, 1-84.99% = green, 85-94.99%= yellow, and 95-100%= red.Is there a way to "read" the report and generate emails based on the results?Advice, links, books, etc. all gratefully received.

No comments:

Post a Comment

Search This Blog