There are three small things to fix. 1. The return value of the script function should be System.DateTime, not DateTime. Attempting to run the script fails with an error message that points to this. 2. The name of the argument to FixHour should be @d, not d. Trying to parse the FUNCTION statement fails because of this but does not explain why - we'll make it say what the problem is. 3. The date literal passed to FixHour in VALUES should be enclosed in #...#. Trying to parse the VALUES statement fails because of this, also without giving you any idea what specifically the problem is - it is kind of hard to guess in this case that the problem is a lack of #...#, but we will try to at least say something about the value passed to FixHour. Corrections in bold: // C# // Adaptation du script de adamw -- http://www.georeference.org/forum/t136681.3#136693 class Script { public static System.DateTime FixHour(System.DateTime p) { return (p.AddHours(-4)); } static Manifold.Context Manifold; static void Main() { } } Query: --SQL FUNCTION FixHour(@d DATETIME) DATETIME AS SCRIPT [Script] ENTRY 'Script.FixHour'; VALUES (FixHour(#3/19/2020 19:08:32#)); Hope this helps.
|