Replies: 4 comments
-
|
Variables are handled by SQLPage itself, you cannot use ms sql variables directly in your SQLPage files. See https://sql-page.com/extensions-to-sql |
Beta Was this translation helpful? Give feedback.
-
|
coule you tell me how to do it? tks! |
Beta Was this translation helpful? Give feedback.
-
|
You can't work with MS SQL variables within SQLPage code, nor can you run Trasact-SQL scripts. Only standard SQL constructs are allowed. So, the most you can do is insert the value of a text variable into a query using concatenation or call a function or procedure, substituting text variables for their parameters, remembering to perform type casts if necessary and possible. Furthermore, no control structures like IF or CASE, loops, or other conveniences are allowed; move any complex logic to procedures and functions in your database server. |
Beta Was this translation helpful? Give feedback.
-
|
an equivalent to what you were trying to do in sqlpage may be: SET y = year(getdate());
SET y = CASE WHEN getdate() < DATEFROMPARTS($y, 6, 10) THEN $y-1 ELSE $y END;
-- then use $y (not @y) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions