Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ORDER BY
- CASE
- WHEN @orderBy = 'ClientName' THEN c.LastName
- WHEN @orderBy = 'EmployerName' THEN cda.Name
- WHEN @orderBy = 'EmploymentDate' THEN cda.StartDate
- END
- ORDER BY
- CASE WHEN @orderBy = 'ClientName' THEN c.LastName END,
- CASE WHEN @orderBy = 'EmployerName' THEN cda.Name END,
- CASE WHEN @orderBy = 'EmploymentDate' THEN cda.StartDate END
- ORDER BY
- CASE
- WHEN @orderBy = 'ClientName' THEN c.LastName
- WHEN @orderBy = 'EmployerName' THEN cda.Name
- ELSE ''
- END,
- CASE
- WHEN @orderBy = 'EmploymentDate' THEN cda.StartDate
- ELSE '19000101'
- END
- ORDER BY
- CASE
- WHEN @orderBy = 'ClientName' THEN c.LastName
- WHEN @orderBy = 'EmployerName' THEN cda.Name
- --gives "yyyy-mm-ddThh:mm:ss.mmm "
- WHEN @orderBy = 'EmploymentDate' THEN CONVERT(varchar(30), cda.StartDate, 121)
- END
- WHEN @orderBy = 'EmploymentDate' THEN cda.StartDate
- WHEN @orderBy = 'EmploymentDate' THEN cast(cda.StartDate as VarChar)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement