I'm converting MS SQL Server codes to Teradata. I found out that Teradata has no replicate function. Below is the sample code
REPLICATE('0',2-LEN(CAST(COLUMN_NAME AS NVARCHAR)))
Is there an alternative function for replicate in Teradata?
Thanks
Try this:
SUBSTR('00', 1, 2-CHARACTER_LENGTH(CAST(COLUMN_NAME AS VARCHAR(10)))
This will repeat the character '0' two minus the length of the column, which is effectively doing the same thing as REPLICATE in SQL Server.
'0'
REPLICATE
General equivalent would be:
select LPAD('0', needed_length, '0');
Try this:
This will repeat the character
'0'two minus the length of the column, which is effectively doing the same thing asREPLICATEin SQL Server.