on 2021 Apr 15 1:09 PM
Hey,
Could someone help me convert this query SQL Server for Hana?
Regards,
César
DECLARE @startano INT = 2018, @endano INT, @ano INT = YEAR(GETDATE()), @lote VARCHAR(3)
SET @endano = @startano + 25;
WITH BaseLote AS (SELECT @startano AS num1, 0 AS num2
UNION ALL
SELECT num1 + 1, num2 + 1 FROM BaseLote WHERE num1 + 1 <= @endano)
SELECT @lote = ('L' + CHAR(num2 + 65) + '%') FROM BaseLote WHERE num1 = @ano
SELECT CASE WHEN MAX(DistNumber) IS NULL THEN
LEFT(@lote,2) + '000000001'
ELSE LEFT(MAX(DistNumber),2) + RIGHT('00000000'+ CONVERT(VARCHAR(12),
RIGHT(MAX(DistNumber), 9) + 1), 9) END
FROM OBTN
WHERE DistNumber LIKE @lote AND LEN(DistNumber) = '11'qu
Hi César,
You can check the document below for guidelines on converting T-SQL to HANA SQL:
Also, the SQL Converter Tool is available here:
Best Regards,
Filipe Vicente
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.