Total Pageviews

Index Created Date


With the help of below query, we can figure out the index created date:


SELECT si.name 'Index Name'
, so.crdate 'Index Created Date'
, OBJECT_NAME(so.id) 'Object Name'
FROM sysindexes si
INNER JOIN sysobjects so
ON so.id = si.id
ORDER BY crdate DESC

CASE Statement


We can use CASE statement in two formats:-

  • Simple CASE statement, where CASE expression compares the given conditional value to determine the result.
  • Search CASE statement, where CASE expression evaluates a set of Boolean expressions to determine the result

Some important points:-

  • CASE statement supports optional ELSE argument.
  • In the case of not supplying ELSE argument, NULL will be taken as default value for ELSE.
  • CASE can be used in any statement like SELECT, UPDATE, DELETE, SET and in clauses like SELECT_LIST IN, WHERE, ORDER BY, HAVING.
  • SQL Server allows for only 10 levels of nesting in CASE expressions.
  • The CASE expression cannot be used to control the flow of execution of Transact-SQL statements, statement blocks, user-defined functions, and stored procedures.
Below is the example:-