#DateForumTypeThreadPost
285302 Jul 2014 @ 02:39 PDTDatabaseReplyexecute immediate with sting in sql statement in teradataHi Frank, your code is correct, a single quote within a string must be replaced by two single quotes. So this should run as-is. Can you show your exact query? Or the full SP source?
285202 Jul 2014 @ 02:35 PDTDatabaseReplyI Have totals by date, - want to get total "to date" for each dateNo need for a join, this is a basic task for a "Windowed Aggregate Function", a cumulative sum: select _date, total, sum(total) over (order by _date rows u...
285130 Jun 2014 @ 10:46 PDTToolsReplyHandling timestamp column during fast exportDid you check what's the bottleneck, BTEQ itself? Why do you prefer BTEQ over FExp? To export delimited data the best choice is a TPT Export in delimited format, no need to manually concat al...
285028 Jun 2014 @ 08:18 PDTDatabaseReplyQuery to Delete all the records in a table in TeradataNope, there's no difference when you add ALL, this is just an optional keyword. You get a FastPath Delete when there's no Trigger/Foreign Key and it's known to the optimizer that the d...
284928 Jun 2014 @ 01:55 PDTDatabaseReplyProblem in passing run time value for the date filed in Teradata viewThere's no way to create a view like that (probably in any existing database). But you can put it in a macro: REPLACE MACRO mymacro (Month_End_Date DATE) AS ( SEL c.week_of_year ...
284827 Jun 2014 @ 01:37 PDTDatabaseReplyConverting hh:mi:ss format to secondsHi Raja, this will fail after 02:46:39 = 9999 seconds. Better use EXTRACT(HOUR FROM t) * 3600 + EXTRACT(MINUTE FROM t) * 60 + EXTRACT(SECOND FROM t) It's easy to put this ...
284726 Jun 2014 @ 11:20 PDTToolsReplyFastload I/O error 42 on flat fileHi Boris, to load CSV you need to use SET RECORD DELIMITED instead of the default FORMATTED specify the delimiter if it's not '|' DEFINE all input as VARCHAR &nb...
284626 Jun 2014 @ 12:13 PDTDatabaseReplyBest way to generate the Sequential numbers : CSUM or IDENTITY columns?There's no need to "PARTITION BY 0", simply remove it. And you get a more efficient plan when you rewrite the cross join to a Scalar Subquery and the Left Join/IS NULL with a NOT EXI...
284526 Jun 2014 @ 07:03 PDTDatabaseReplyoptimize the queryWithout DDL and Explain it's hard to tell. NOT IN in an ORed condition might be bad, you probably don't need the join and can rewrite it with a simple NOT EXISTS: OR NOT EXISTS (select * ...
284426 Jun 2014 @ 06:52 PDTGeneralReplyTeradata SQL query runCheck syslib if they exist, maybe you're not using them correctly. Both need parameters, e.g. REPLACE FUNCTION SYSLIB.MonitorSQLSteps (HostIdIn SMALLINT, SessionNoIn INTEGER, R...
284326 Jun 2014 @ 06:50 PDTGeneralReplyI have alpanumeric,character and interger values in my column,by using case i want to char values as 'C',int values as 'I'.Hi Purushotham, without UDF or RegEx there's no easy way to determine that. You could create a monster CASE to check each character for it's character class: CASE WHEN SUBSTRING(c...
284226 Jun 2014 @ 06:45 PDTGeneralReplyA constant value in a query is not valid for columnHi Amit, all your decimal values are not valid. The first number in a DECIMAL defines the number of significant digits and the 2nd the fractional digits, so for a DECIMAL(15,15) the maximum value...
284125 Jun 2014 @ 10:21 PDTDatabaseReplyMigrating Access Tables to TeradataIs the Teradata Client installed on your system? Then check the Start-menu for Teradata Client and see if there's a OleLoad or a Teradata Parallel Transporter Wizard.  Both can be used t...
284024 Jun 2014 @ 06:40 PDTDatabaseReplyIdentifying CPU wait time and IO wait time of a QueryAs ResUsage is on system level you can't use it to get session level data. You might check the query in Viewpoint and use the Rewind feature to go back in time. Otherwise compare DBQL step da...
283924 Jun 2014 @ 06:36 PDTGeneralReplyI have defined PPI on a table.But i am not using PPI in a Where clause,how would be the performanceIt's not always better, only if the partitioning column is not part of the PI. And the performance decrease mainly depends on the number of populated partitions, if it's just a few perform...
283824 Jun 2014 @ 06:32 PDTGeneralReplyTeradata SQL query runIf you got luck (i.e. access rights) you might also access PMon data using some table-UDFs, e.g. MonitorMySessions MonitorSQLSteps MonitorSQLCurrentStep   Check the "Application Prog...
283724 Jun 2014 @ 05:03 PDTDatabaseReplyMonitor PartitionThe "Monitor" partition is used for Performance Monitor-API requests like "MONITOR SESSION".
283623 Jun 2014 @ 12:16 PDTToolsReplyHandling timestamp column during fast export22M records is not that much, but it mainly depends on the overall size, 22M * 100 bytes or 22M * 10KB... You should try to find the bottleneck: BTEQ is single-threaded, so check if one CPU is ru...
283523 Jun 2014 @ 12:04 PDTGeneralReplywithout specifying CASE SPECIFIC in a table, How can we retrieve only lower case letters in teradataCHi Purushotham, You can simply add CASESPECIFIC within your query: WHERE col (CASESPECIFIC) = 'suresh'  If you always need to get a case sensitive comparison you should be...
283422 Jun 2014 @ 11:22 PDTToolsReplyHandling timestamp column during fast exportThere's no automatic typecast for TIME and TIMESTAMP, you must do it explicitly: ... SUBSRPTN_STS_RSN_DESC ||'|'|| CAST(entry_dt_tm AS VARCHAR(20)) (title '')  
283320 Jun 2014 @ 07:27 PDTGeneralReplyhow to eliminate duplicate records in a file while loading into the target table without using fastloadHi Purushotham, you can't do that with MultiLoad if the target table is MULTISET. You got two options: 1. use Unix to remove duplicates before loading as Raja suggested 2. FastLoad to a sta...
283220 Jun 2014 @ 06:41 PDTDatabaseReplySELECT AGGREGATE ERRORIf a column Patient_Status exists the parser will use this instead of the alias "Patient_Status". So use a different alias or GROUP BY 1,2,3,4,5,6,7,8,9,10 instead.
283120 Jun 2014 @ 12:48 PDTAnalyticsReplySELECT Failed. 3706: Syntax error: expected something between '(' and the 'select' keyword.Are you shure it's this SQL? There's no fill_type_cd within it and it should run as-is.
283020 Jun 2014 @ 12:35 PDTDatabaseReplyQuery to Delete all the records in a table in TeradataBig tables are usually partitioned by date, e.g PARTITION BY RANGE_N (trans_date BETWEEN DATE '2005-01-01' AND DATE '2020-12-31' EACH INTERVAL '1' DAY When you DELE...
282920 Jun 2014 @ 12:28 PDTGeneralReplyHOW TO RUN SAME DML STATEMENT IN 'N' NO OF TIMES IN BTEQThere are two way in BTEQ, the one Raja mentioned: your_select; =n .repeat n your_select;  

Pages