3303 | 19 Nov 2014 @ 03:09 PST | General | Reply | Calculating for a 45-Day Grace Period | Hi Genesius,
I don't fully understand your problem :)
What data already exists and what do you need to calculate?
Do you want to get all bill periods for the given begin/end date of a custom... |
3302 | 16 Nov 2014 @ 06:12 PST | Database | Reply | Advice on table partitioning | Hi Zulfi,
each partition in a PPI table is still distributed across all AMPs. But newer releases of Teradata will do the STAT steps with a spool "built locally" when the PI is part of th... |
3301 | 16 Nov 2014 @ 03:13 PST | Database | Reply | Unable to insert | Hi Rohit,
Insert adds new rows, but this looks like you want to update an existing row:
update emp
set hire_date = date '2009-03-18'
where eno= 2
|
3300 | 15 Nov 2014 @ 01:09 PST | Database | Reply | Help on Below SQL | Hi Abhijeet,
simply compare Explain and actual cpu/io in the query log.
Better performing than NOT IN/UNION should be this:
SELECT DISTINCT source_Place, destination_Place, distance
FROM dist... |
3299 | 15 Nov 2014 @ 10:05 PST | Database | Reply | Help on Below SQL | Hey, this is one of the labs I do in my trainings ;-)
There are several solutions to this problem, their performance mainly depends on the number of duplicates. Usually a good one is a ROW_NUMBER:... |
3298 | 15 Nov 2014 @ 02:41 PST | Database | Reply | Use of CTE within stored procedures | Your MOD function uses ODBC syntax which is automatically rewritten when you connect using ODBC, the "Disable Parsing" option has not been checked and the query is a DML statement.
 ... |
3297 | 15 Nov 2014 @ 02:35 PST | General | Reply | BTEQ .IF ERRORCODE <> 0 THEN <QUERY> | Hi Amit,
you might either omit the period in front of IF or utilize GOTO/LABEL:
.IF ERRORCODE = 0 THEN .GOTO skipit
<query>;
.LABEL skipit;
IF ERRORCODE <> 0 THEN
<query... |
3296 | 14 Nov 2014 @ 02:14 PST | Database | Reply | proc call in bteq ansi mode error | You need to COMMIT the DATABASE command :-)
|
3295 | 12 Nov 2014 @ 09:25 PST | Database | Reply | ALTER Secondary Index | DBMSes usually don't have syntax for altering a index, do DROP INDEX + CREATE INDEX instead.
|
3294 | 12 Nov 2014 @ 08:55 PST | Database | Reply | Data skew /qry running long | If you think you need to check for skew in a join you should do it on the column combination.
|
3293 | 12 Nov 2014 @ 08:53 PST | Database | Reply | Problem in grouping multiple "case" statement | You need to fix your logic, e.g.
SUM(case
when (ID_CLS_DATO='31') then AM_FNMN
END) as TOT_AM_FNMN_ACRDT
|
3292 | 12 Nov 2014 @ 08:52 PST | Analytics | Reply | NTILE Function in TOAD | Hi Parvathi,
NTILE is not implemented in Teradata, but similar syntax, check
Missing functions: CUME_DIST & NTILE
|
3291 | 12 Nov 2014 @ 08:47 PST | Database | Reply | how to implement connect by level in teradata | Hi Anirudh,
Teradata support Standard SQL's WITH RECURSIVE instead of CONNECT BY.
But you don't need recursion to split a string, in TD14 there's STRTOK_SPLIT_TO_TABLE, e.g.
S... |
3290 | 11 Nov 2014 @ 01:27 PST | Database | Reply | Teradata Stored Procedure | You need to check the actual SQL_STATEMENT, either by setting an OUT parameter or inserting it into a logtable.
|
3289 | 11 Nov 2014 @ 01:22 PST | General | Reply | Select data from one row, while on another row in the same table. | Hi Genesius,
you will probably not succeed without adding a join.
And to get the first three characters of the weekday you better use CAST(CAST(OrigDueDate AS FORMAT 'E3') AS CHAR(3))
|
3288 | 11 Nov 2014 @ 11:13 PST | General | Reply | Convert multiple rows into single row | There's no way to determine a specific order for UDFConcat, you need to use the old style max(case)
SELECT Itinerary,
MAX(CASE WHEN rn = 1 THEN TRIM(PromoType) ELSE '' end... |
3287 | 11 Nov 2014 @ 09:45 PST | Database | Reply | mload for multiple tables | There's a missing semicolon before the .IMPORT
|
3286 | 11 Nov 2014 @ 09:07 PST | Database | Reply | Dynamic date roll up | This will return a date based on your definition:
MIN(date) OVER (PARTITION BY id) + ((date - MIN(date) OVER (PARTITION BY id)) / 28 * 28)
|
3285 | 09 Nov 2014 @ 02:15 PST | Database | Reply | Suggestion to use ALL or MAX function | Hi Nirav
>= ALL is very uncommon SQL syntax, better go with = MAX, which has a better plan.
But you could also utilize an OLAP function:
SELECT NAME, SUB_1, SUB_2, SUB_3
FROM STUDENT_... |
3284 | 09 Nov 2014 @ 03:42 PST | Database | Reply | Dealing with trailing whitespace | What's you Teradata release?
Check if Oracle's RTRIM function is available, which allows multiple characters to be trimmed:
RTRIM(col2, '20090A0B0DA0'xc)
|
3283 | 09 Nov 2014 @ 03:37 PST | General | Reply | what is the use of sel CHAR2HEXINT(COL2) FROM TABLENAME?COULD ANYONE PLS EXPLAIN ME. | Hi Purushotham,
CHAR2HEXINT returns the hexadecimal representation of the input string.
Your column name is a CHAR(10), so it's padded with blanks to the defined size:
41='A... |
3282 | 09 Nov 2014 @ 03:25 PST | General | Reply | IN Realtime in which scenaries we will get a table does not exist error? | You get this error when the table doesn't exist :-)
Can you provide more details?
|
3281 | 09 Nov 2014 @ 03:23 PST | Database | Reply | Using data from previous / next row as condition | Hi Yarin,
you need the LAG function, both LAG/LEAD are not implemented in Teradata., but easy to rewrite:
LEAD(data_col, offset, defaultvalue) OVER (ORDER BY order_col)
=
COALESCE(MIN(data_... |
3280 | 08 Nov 2014 @ 07:26 PST | General | Reply | Select data from one row, while on another row in the same table. | Hi Genesius,
don't try to calculate the new date in the CTE, better add another join:
WITH cte (YofC, DofY, OrigDueDate, DofW, Hol, NewDueDate, NewDoW) AS
(SELECT
SCC.Year_Of_Calen... |
3279 | 07 Nov 2014 @ 11:49 PST | Database | Reply | Index/Partition design for Transaction Tables | You have to pay a price when you store data in name-value pairs instead ot rows...
You'll find a lot pros and cons (well, mainly cons) when you search for the data model called EA... |