Tuesday, January 3, 2017

Split function in sql

Create  FUNCTION [dbo].[fnSplitPosToString] (
 @string VARCHAR(MAX)
 ,@delimiter CHAR(1)
 )

 RETURNS @output TABLE (Id int identity (1,1),data VARCHAR(256))
 
BEGIN
 DECLARE @start INT
     ,@end INT
 
 SELECT @start = 1
  ,@end = CHARINDEX(@delimiter, @string)
 
 WHILE @start < LEN(@string) + 1
 BEGIN
  IF @end = 0
   SET @end = LEN(@string) + 1
 
  INSERT INTO @output (data)
  VALUES (SUBSTRING(@string, @start, @end - @start))
 
  SET @start = @end + 1
  SET @end = CHARINDEX(@delimiter, @string, @start)
 END
 
 RETURN
END

AngularJS Scope Methods

$watch: This method is used to watch value changes in scope properties or variables.
$watchGroup: This method is used to watch value in scope array variable.
$watchCollection: This method is used to observe properties on a single object.
$on: This method is used to listens dispatched events of a given type
$emit: This method is used to dispatches an event name upwards and travel up to        $rootScope.scope listeners.
$broadcast: This method is used to dispatches an event name downward to all child scopes notify the registered $rootScope listeners.
$new: This scope object method creates a new child scope.
$digest: This scope method processes all of the watchers of the current scope and its children.
$destroy: This scope method is used to removes the current scope (and all of its children) from the parent scope.
$eval: This scope method is used to executes the expression on the current scope and returns the result.
$apply: This scope method is used to execute an expression in angular from outside of the angular framework.