#DateForumTypeThreadPost
330319 Nov 2014 @ 03:09 PSTGeneralReplyCalculating for a 45-Day Grace PeriodHi 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...
330216 Nov 2014 @ 06:12 PSTDatabaseReplyAdvice on table partitioningHi 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...
330116 Nov 2014 @ 03:13 PSTDatabaseReplyUnable to insertHi 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  
330015 Nov 2014 @ 01:09 PSTDatabaseReplyHelp on Below SQLHi 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...
329915 Nov 2014 @ 10:05 PSTDatabaseReplyHelp on Below SQLHey, 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:...
329815 Nov 2014 @ 02:41 PSTDatabaseReplyUse of CTE within stored proceduresYour 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.  ...
329715 Nov 2014 @ 02:35 PSTGeneralReplyBTEQ .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...
329614 Nov 2014 @ 02:14 PSTDatabaseReplyproc call in bteq ansi mode errorYou need to COMMIT the DATABASE command :-)
329512 Nov 2014 @ 09:25 PSTDatabaseReplyALTER Secondary IndexDBMSes usually don't have syntax for altering a index, do DROP INDEX + CREATE INDEX instead.
329412 Nov 2014 @ 08:55 PSTDatabaseReplyData skew /qry running longIf you think you need to check for skew in a join you should do it on the column combination. 
329312 Nov 2014 @ 08:53 PSTDatabaseReplyProblem in grouping multiple "case" statementYou need to fix your logic, e.g. SUM(case when (ID_CLS_DATO='31') then AM_FNMN END) as TOT_AM_FNMN_ACRDT  
329212 Nov 2014 @ 08:52 PSTAnalyticsReplyNTILE Function in TOAD Hi Parvathi, NTILE is not implemented in Teradata, but similar syntax, check Missing functions: CUME_DIST & NTILE
329112 Nov 2014 @ 08:47 PSTDatabaseReplyhow to implement connect by level in teradataHi 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...
329011 Nov 2014 @ 01:27 PSTDatabaseReplyTeradata Stored ProcedureYou need to check the actual SQL_STATEMENT, either by setting an OUT parameter or inserting it into a logtable.
328911 Nov 2014 @ 01:22 PSTGeneralReplySelect 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))
328811 Nov 2014 @ 11:13 PSTGeneralReplyConvert 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...
328711 Nov 2014 @ 09:45 PSTDatabaseReplymload for multiple tablesThere's a missing semicolon before the .IMPORT
328611 Nov 2014 @ 09:07 PSTDatabaseReplyDynamic date roll upThis will return a date based on your definition: MIN(date) OVER (PARTITION BY id) + ((date - MIN(date) OVER (PARTITION BY id)) / 28 * 28)  
328509 Nov 2014 @ 02:15 PSTDatabaseReplySuggestion to use ALL or MAX functionHi 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_...
328409 Nov 2014 @ 03:42 PSTDatabaseReplyDealing with trailing whitespaceWhat's you Teradata release? Check if Oracle's RTRIM function is available, which allows multiple characters to be trimmed: RTRIM(col2, '20090A0B0DA0'xc)  
328309 Nov 2014 @ 03:37 PSTGeneralReplywhat 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...
328209 Nov 2014 @ 03:25 PSTGeneralReplyIN 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?
328109 Nov 2014 @ 03:23 PSTDatabaseReplyUsing data from previous / next row as conditionHi 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_...
328008 Nov 2014 @ 07:26 PSTGeneralReplySelect 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...
327907 Nov 2014 @ 11:49 PSTDatabaseReplyIndex/Partition design for Transaction TablesYou 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...

Pages