#DateForumTypeThreadPost
5402 Sep 2016 @ 06:30 PDTDatabaseReplyreplacing existing column You can create the all_apps2 same as all_apps1 and write an update statement for prcd_amt Or you could just use 'HELP TABLE all_apps1' to get the column list and copy paste it in the Selec...
5302 Sep 2016 @ 06:11 PDTDatabaseReplyDECLAREYou can define of parameter variables in Macors, Stored procedures and utilities such as Fastload, Mload etc. You cannot 'DECLARE' a variable outside of these. What are you trying to achiev...
5229 Aug 2016 @ 06:09 PDTDatabaseReplyextract time from timestamp(6)SELECT CAST(SUBSTR(CAST(<COL> AS VARCHAR(20)),12,19) AS TIME(0))
5129 Aug 2016 @ 03:59 PDTDatabaseReplyMerge different rows in one rowYou could do this: SEL Act_dt,cust_id and cust_line_id,MAX(flg1), MAX(flg2), MAX(flg3), MAX(metric1), MAX(metric2), MAX(metric3)  FROM <TABLE> GROUP BY 1...
5023 Aug 2016 @ 03:40 PDTDatabaseReplyrows unbounded precedingWhy is the result of the 3rd row 500 (and not 500-80 = 420)? Should there be no subtraction within a month? Also is the date format in example given DD/MM/YYYY?
4922 Aug 2016 @ 09:52 PDTDatabaseReplyConvert date > xx/01/xxxx of given month to first of following monthSEL CASE WHEN EXTRACT (DAY FROM COLUMNNAME) > 2 THEN ADD_MONTHS((COLUMNNAME - EXTRACT(DAY FROM COLUMNNAME)) +1,1) ELSE COLUMNNAME END Use your column name inplace of 'COLUMNNAME'
4822 Aug 2016 @ 09:11 PDTDatabaseReplyConvert date > xx/01/xxxx of given month to first of following monthTry this SEL CASE WHEN EXTRACT (DAY FROM CURRENT_DATE) <> 1 THEN (CURRENT_DATE - EXTRACT(DAY FROM CURRENT_DATE)) +1 END Just replace the CURRENT_DATE with your column name
4722 Aug 2016 @ 03:49 PDTDatabaseReplyResource Monitoring While Running Sql querriesYou can use Viewpoint for this.
4626 Jul 2016 @ 08:03 PDTDatabaseReplyWhat is difference between Redistribution of rows and Duplication of small table in AMPsYes, that is correct at a high level. Redistribution will be based on hash code of the joining column(s)
4521 Jul 2016 @ 09:01 PDTDatabaseReplyHow to calculate minimum & maximum values based on a column only if the records are continuousRefer to this thread http://forums.teradata.com/forum/database/consolidate-rows
4421 Jul 2016 @ 04:15 PDTDatabaseReplyHow to calculate minimum & maximum values based on a column only if the records are continuousDon't understand how you identify 'only when col2 is continuous' : A physical file has order of records, but in Table does not have an implicit order of records. If this needs to ...
4313 Jul 2016 @ 01:54 PDTDatabaseReplyCalculate column value based on previous computed valueHere you go SEL ORG, DEST ,COALESCE (FRU-SUM(VEG) OVER (ORDER BY VEG DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING), FRU) AS FRU ,VEG ,FRU - SUM(VEG) OVER (ORDER BY VEG DESC ROWS UNB...
4212 Jul 2016 @ 07:58 PDTDatabaseReplyCalculate column value based on previous computed valueYou can do this as given below SEL VAL.*, FRU - CSUM(VEG,VEG DESC) AS TOTAL FROM test VAL  
4112 Jul 2016 @ 04:15 PDTGeneralReplycumulative sum and moving average You can try something like below SEL CSUM(salary,cont_join_date), MAVG(salary,6,cont_join_date) FROM <TABLENAME> WHERE EXTRACT (YEAR FROM cont_join_date) = 2015 AND EXTRACT (MONTH FROM ...
4029 Jun 2016 @ 06:26 PDTGeneralReplySome roles are showing in DBC.ROLEINFO but not in DBC.ALLROLERIGHTS DBC.RoleInfo view provides information of all roles defined (It is derived from DBC.Roles table) DBC.AllRoleRights view provides information about the rights granted to each role You can fi...
3928 Jun 2016 @ 09:20 PDTGeneralReplyStore Backup of table strucutre into an table If you have a process to maintain the tables without ALTER (Backup data, Drop & Recreate for changes), you could just directly use the 'RequestText' value from DBC.Tables SEL Databas...
3828 Jun 2016 @ 09:11 PDTGeneralReplytranspose in teradata(columns to rows viseversa)You can also try out the TD_UNPIVOT Function (available from Teradata 14.10)
3728 Jun 2016 @ 08:56 PDTGeneralReplytable needs changeThis can be done in multiple ways. Below is one way: SEL ROLL , CASE WHEN (EXECF =1 OR LARGEF = 1 OR MED = 1 OR SM = 1) THEN NULL ELSE AUTOF END AS AUTOF , CASE WHEN (EXECF =1 OR LARGEF = 1 OR...
3628 Jun 2016 @ 08:19 PDTGeneralReplyJoin IndexIf your sql is covering sql. ie all columns needed to process the query are present in the existing index. If a query refers to only columns that are part of the index, Teradata would decide ...
3528 Jun 2016 @ 08:00 PDTGeneralReplyHow to detect updates in a teradata table at runtime without using timestamp column or last acess time stamp,You may want to explore 'Triggers' 
3401 Sep 2014 @ 06:23 PDTGeneralReplySTRIPING WHITE SPACESIf you need to remove only WHITE SPACES, you can use TRIM
3321 Nov 2013 @ 07:14 PSTGeneralReplyCollecting Stats Generally speaking; Yes you should collect stats on the column, so that optimiser is aware of the low cardinality of the column You can also compare Explain plan in both...
3218 Nov 2013 @ 07:51 PSTData ModelingReplyFinancial.... LDMYes FSLDM has 10 Subject Areas, which you have listed. Also: "The current version of the FS-LDM contains more than 3,100 entities, 12,700 attributes, and 5,100 relationships."
3118 Nov 2013 @ 07:36 PSTDatabaseTopicStart from specific sql in Stored ProcedureIs it possible to start execution of a Stored Procedure from a specific location? My SP has a series of sqls with STEP_ID assigned. I need to pass a STEP_ID value and excute only from that STEP_ID...
3015 Sep 2013 @ 02:17 PDTDatabaseReplyBulk LoadingYou can try using Identity Column in DDL

Pages