In teradata proc sql in SAS Enterprise guide environment, I am trying to create a column by multiplying two fields, but I have been having overflow issue. How do I specify the number of decimals in …
Tag: teradata
How to ‘create’ NULL data in Teradata SQL for non existing relations
I have 2 tables, one lists features with a feature value that an account might or might not have (TBL_Feat), the other lists the accounts (TBL_Acct). I’m looking for a query to give me all features …
How to select an id when we do not have matching records in Teradata
Say i have two tables like below: +————————-+ +————————-+ | Person | | Person Details | +———-+————–+ +——————-…
teradata, reset when, partition by, order by
I need help understanding the below code. I have never seen reset when used in Teradata. What does RESET WHEN do in Teradata? I understand the partition and order by part. I was also unsure why this …
Teradata Dynamic SQL with Bind Variables?
Is it possible to use bind variables in a Teradata dynamic SQL statement? I can’t find an example anywhere. I’m looking to do something like this: DECLARE SQLString VARCHAR(1000) SET SQLString = ‘…
Teradata locks table for read while accessing to table through view with access rights
This is really weird. I have 2 view, one with access rights and other with read rights to table. replace view v1_read as locking row for read select id1 from t1; replace view v2_access as locking …
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
EXTRACT the date and time – (Teradata)
I am trying to extract the date and time from a field in Teradata. The field in question is: VwNIMEventFct.EVENT_GMT_TIMESTAMP Here is what the data look like: 01/02/2012 12:18:59.306000 I’d like …