function RegisterSQLFunctions: string;
begin
   RegisteredSQLFunctions.AddObject('scrDow', TnxSQLFunctionInfo.Create(
          'scrDow', 1 , rttExplicit, true, '', '', nxtInt32, 0, 0, '', 0, '', 0));
end;

function scrDow (const ADate: Variant): Variant;
var
  i : integer;
  x : integer;
begin
  i := (round(ADate) -1) mod 7;
  result := i;
end;

begin
end.

