Monday, July 29, 2013

CASE Statements in A SQL UPDATE Query

  • UPDATE
  • [account]
  • SET
  • balance =
  • (
  • CASE
  • WHEN
  • ((balance - 10.00) < 0)
  • THEN
  • 0
  • ELSE
  • (balance - 10.00)
  • END
  • )
  • WHERE condition

Thursday, July 11, 2013

DBA /BI Engineer Post

Country: Tanzania
City: Dar Es Salaam
Qualification
  • A Bachelor’s degree in Computer Engineering, Computer Science, Industrial Engineering/Operations  Mathematics, Management Information Systems.
  • Skills in Database operations, SQL queries, etc
  • Knowledge of best practices and principles for ETL, data modeling, dashboards, report design, analytics, and data mining
  • Strong work ethic
  • Ability to multi-task effectively and be comfortable working in a fast-paced, dynamic environment without close guidance or supervision
  • Strong leadership skills
  • Excellent verbal and written communication skills
  • High degree of attention to detAILS
dEADLINE 16/07/2013

Saturday, June 22, 2013

Find Last Day of Any Month (SQL Server)

a) Find the last day of the previous month, current month and next month.

  • Last Day of Previous Month
SELECT DATEADD(s,-1,DATEADD(mmDATEDIFF(m,0,GETDATE()),0))
  • Last Day of Current Month
SELECT DATEADD(s,-1,DATEADD(mmDATEDIFF(m,0,GETDATE())+1,0))

  • Last Day of Next Month
SELECT DATEADD(s,-1,DATEADD(mmDATEDIFF(m,0,GETDATE())+2,0))

b). Last day of any day specified.

  • Last Day of Any Month and Year
DECLARE @dtDate DATETIMESET @dtDate '8/18/2007'SELECT DATEADD(s,-1,DATEADD(mmDATEDIFF(m,0,@dtDate)+1,0))