#DateForumTypeThreadPost
217821 Aug 2013 @ 02:01 PDTDatabaseReplyCan multiple joins be avoided for the same table?That's a variation of the common problem "how many working days were needed to process this task": Add a new SMALLINT column to your calendar table like holiday_seqnum and populate i...
217721 Aug 2013 @ 01:52 PDTDatabaseReplyLike Operator in TeradataHi Adharssh, instead of TRIM(DatabasesName) you can also switch to dbc.ColumnsV instead where DatabaseName is a VARCHAR(128). Since TD12 there's the new set of dbc views all ending on V ...
217620 Aug 2013 @ 09:55 PDTDatabaseReplyCOUNT () OVER (PARTITION BY) and DISTINCTHi Gwen, SELECT DISTINCT is processed after the OPAP function and COUNT(DISTINCT)  can't be used in OLAP, but in this case you don't need it, just GROUP BY first: SELECT name ...
217519 Aug 2013 @ 08:01 PDTDatabaseReplyCombine Multiple Select StatementsA Derived Table (aka Inline View in Oracle) is a nested SELECT, i.e. a SELECT statement instead of table/view reference in the FROM clause, e.g. SELECT t1.datetm, t1,cnt, t2.cnt FROM ( SE...
217419 Aug 2013 @ 03:42 PDTDatabaseReplyUsing static Day value in a particular Date To get the nth of a month (n=0 returns the last day of the previous month): DATE - (EXTRACT(DAY FROM DATE ) - n) Caution, this works for a single calculation in an IN clause, but when you add ...
217318 Aug 2013 @ 05:22 PDTDatabaseReplyquery on CSUMEXPAND only works on PERIODs, you have to construct one on the fly. SELECT name, newdate, SUM(CASE WHEN datecol = newdate THEN measure ELSE 0 END) OVER (PARTITION BY name OR...
217218 Aug 2013 @ 03:42 PDTDatabaseReplyquery on CSUMLast try: How is the minimum/maximum date determined?   Dieter
217118 Aug 2013 @ 02:49 PDTDatabaseReplyquery on CSUMHi Ramaiah, you reveal information only one at a time :-) So again: How is the minimum/maximum date determined, is it the same for all names or different for each name?    Dieter
217017 Aug 2013 @ 12:28 PDTDatabaseReplyquery on CSUMHi Ramaiah, what's your release? In TD13.10 you can use EXPAND ON to get the missing dates.  How is the minimum/maximum date determined, is it the same for all names or different for eac...
216916 Aug 2013 @ 02:41 PDTDatabaseReplyCombine Multiple Select StatementsJust put each SELECT in a Dervived Table and Join them on the DATE. Additionally you might reduce the number of queries by combining those with the same JOINs, but different WHERE into a single qu...
216816 Aug 2013 @ 02:33 PDTDatabaseReplyDeleting duplicate rows in multiset tableHi Mahesh, you can't do that without an intermediate table (unless you use the internal ROWID which is no longer available). Depending on the number of duplicates you might do Harpreet's&...
216716 Aug 2013 @ 02:28 PDTDatabaseReplyDisctribution of rows in Fall back AMPsHi Mahesh, it's using the same hashing algorithm, but a different hashmap, the Fallback Hashmap. Check the Database Design manual:   Chapter 8: Teradata Database Indexes and Partitioni...
216616 Aug 2013 @ 02:22 PDTDatabaseReplyIssue in loading "?" as first character in the field.I assume you run it in SQL Assistant? Go to Tools- Options - Query and uncheck Allow use of Named Parameters in queries   Dieter 
216515 Aug 2013 @ 05:07 PDTDatabaseReplyCan multiple joins be avoided for the same table?Hi Sagar, you might do a LEFT JOIN using an ORed condition plus some CASE, but this will result in a real bad product join. So better keep the two joins :-)   Dieter
216415 Aug 2013 @ 05:07 PDTDatabaseReplyFormatting date in Multiload dd-mmm-yyThis behaviour is defined by the "century break" setting, it can only be changed on a system level by your DBA using dbscontrol. Otherwise there are two solutions: - insert '20'...
216315 Aug 2013 @ 04:56 PDTToolsReplyBTEQ - want to Generate a record number based on order of rows inserted that is sequentialYou can use IDENTITY when you logon a single session in BTEQ. Then all rows are processed by a single PE which means sequential numbering. Similar for FastLoad when using a single session, in this...
216215 Aug 2013 @ 04:44 PDTDatabaseReplyPPI or NUSI?Hi Nishant, why don't you simply try it yourself and explain the query? You would have noticed that your DDL will fail.   Dieter
216115 Aug 2013 @ 04:39 PDTAsterReplyAster_function load_from_teradataDid you use the mr_driver table? Could you post your full code? Dieter
216013 Aug 2013 @ 02:04 PDTDatabaseReplyquery on CSUMSorry, but this is not readabla/understandable. You should provide DDL and some INSERTs.   Dieter
215913 Aug 2013 @ 05:25 PDTTeradata ApplicationsReplyHow to handle failure statement in Bteq ?Hi Carlos, the default in BTEQ is to ignore any error and go on with processing, only SQL Assistant stops by default :-)   Dieter
215813 Aug 2013 @ 05:07 PDTDatabaseReplyCan we use position function in stored procedureOf course you can. Is it part of the SPL code or within a SQL? Could you show what you did so far?   Dieter
215713 Aug 2013 @ 05:01 PDTDatabaseReplyhelp me to group the recordsYou'll find the function in the "Functions & Operators" manual, but it's not really "well documented". Those functions only work for PERIODs and need a WITH to prov...
215613 Aug 2013 @ 03:54 PDTTeradata ApplicationsReplyHow to handle failure statement in Bteq ?You might add .IF ERRORCODE <> 0 THEN .QUIT after each insert or .SET MAXERROR = 1; before .RUN FILE. Both will stop after the first error. If you want to run this as all or nothing yo...
215513 Aug 2013 @ 03:45 PDTAnalyticsReplygroup the records based on dateWhat have you done already? Wrote a query and now you need to optimize it? So why don't you simply show what you already got? My crystal ball is still broken.   Dieter
215413 Aug 2013 @ 02:23 PDTDatabaseReplyhelp me to group the recordsCheck  http://forums.teradata.com/forum/general/need-help-merging-consecutive-and-overlapping-date-spans   Dieter

Pages