Skip to content
Advertisement

Tag: teradata

Teradata REPLICATE function?

I’m converting MS SQL Server codes to Teradata. I found out that Teradata has no replicate function. Below is the sample code Is there an alternative function for replicate in Teradata? Thanks Answer Try this: 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.

SQL/Regex Challenge/Puzzle: How to remove comments from SQL code (by using SQL query)?

Requirements Single-lines comments (e.g. — my comment) should be removed. Multi-line comments (e.g. /* my comment */) should be removed. The content of strings literals (e.g. ‘this is a multi-line comment: /* my comment */’) should be ignored. The content of identifiers (e.g. “– column 1 –“) should be ignored. literals and identifiers Literals and identifiers can span over multiple

Teradata SQL Same Day Prior Year in same Week

Need help figuring out how to determine if the date is the same ‘day’ as today in teradata. IE, today 12/1/15 Tuesday, same day last year was actually 12/2/2014 Tuesday. I tried using current_date – INTERVAL’1’Year but it returns 12/1/2014. Answer You can do this with a bit of math if you can convert your current date’s “Day of the

Advertisement