Apply operator in sql server