753 | 14 Jun 2010 @ 04:18 PDT | Database | Reply | How do these queries execute? | There's a simple rule:
*First* there's the join based on every condition in ON, *then* the WHERE-conditions are applied.
a: "a.n_name is null" is part of the JOIN-condition, so it's returning a... |
752 | 14 Jun 2010 @ 04:02 PDT | Database | Reply | UDF Compilation | If this is yor actual C-source, there's a lot missing :-)
You should start reading the Orange Book on UDFs (http://www.teradata.com/DownloadCenter/Topic9233-132-1.aspx) or the modules about UDFs... |
751 | 14 Jun 2010 @ 03:44 PDT | Database | Reply | How to get the list of procedures? | It's the same way you get the list of tables, it's just a different TableKind:
select * from dbc.tables
where databasename = your_db
and TableKind = 'P'
Dieter |
750 | 13 Jun 2010 @ 01:22 PDT | Database | Reply | Problem: concatenate multi rows in one row and column | Hi Marco,
http://www.teradataforum.com/teradata/20060710_173415.htm
But the fastest (and easiest) solution is an Aggregate UDF.
Dieter |
749 | 10 Jun 2010 @ 11:25 PDT | General | Reply | Need clarification in PI..... | Why do you insist on a Hash Join?
The plan is as good as possible.
It's a direct merge join using the existing PPI without any preparation.
There's no need to change the PI, but you should m... |
748 | 10 Jun 2010 @ 10:43 PDT | Database | Reply | How to generate permutations using SQL? | Simply CROSS JOIN those tables:
select * from table1 CROSS JOIN table2 CROSS JOIN table3
or using old comma delimited syntax:
select * from table1, table2, table3
Dieter |
747 | 09 Jun 2010 @ 12:23 PDT | Database | Reply | insert records time incremental | Sorry, but i don't understand your question.
Could you please elaborate on what you actually want to achieve?
Dieter |
746 | 09 Jun 2010 @ 12:20 PDT | Database | Reply | Need help with Unicode in DDL issue | Hi Jonas,
the data dictionary is capable of storing unicode data, the view source code is stored in dbc.tvm.createtext/requesttext, which are both declared as unicode.
REPLACE VIEW D_ORG_PSC_HI... |
745 | 08 Jun 2010 @ 11:40 PDT | Database | Reply | Problem with DBQLogTbl data | No,
FirstRespTime - StartTime is the elapsed time needed to create the answer set.
AMPCpuTime is the cpu seconds used by all AMPs to create that answer set.
As you got lots of CPUs you might ... |
744 | 08 Jun 2010 @ 11:33 PDT | Database | Reply | Teradata dbms structure and navigation, catalog commands? | Hi Steve,
if you know the database name there's a "Find" in the "Edit" menu.
dbc is the root for all databases/users.
As database/user names are unique you don't have to know the "path" to a d... |
743 | 31 May 2010 @ 03:27 PDT | Database | Reply | How to get the integer part of a numeric field | It's CAST(xx as BIGINT).
There's no CONVERT in SQL/Teradata, if it worked you probably used SQL Assistant and tools -> options -> query -> "allow use of sql extensions in queries" was checked. T... |
742 | 28 May 2010 @ 01:42 PDT | Database | Reply | Hilite and execute, stacking sql in macros | No menu?
I didn't know you could hide the Menubar...
Try ALT-T for the Tools menu.
Or right click any toolbar and choose Customize, in the Options tab there's a "Reset my usage data" button, m... |
741 | 27 May 2010 @ 12:43 PDT | Database | Reply | Desperately need ur help! | SELECT task_id, hierarchy,
ROW_NUMBER()
OVER (PARTITION BY hierarchy
ORDER BY r) AS rn
FROM (SELECT task_id, hierarchy, random(1,10000000) from tasks) as t
Dieter |
740 | 27 May 2010 @ 11:33 PDT | Database | Reply | Desperately need ur help! | You have to order by something random.
As RANDOM is not allowed in OLAP-functions you could use HASHROW instead, it's not truely random but repeatable:
SELECT task_id, hierarchy,
ROW_NUMBER()... |
739 | 27 May 2010 @ 11:28 PDT | Database | Reply | Hilite and execute, stacking sql in macros | 1. There's an option "submit only selected query text when highlighted" in options - query
For some historical reason it's unchecked by default.
2. Of course you might have multiple DML stateme... |
738 | 27 May 2010 @ 08:05 PDT | Database | Reply | Desperately need ur help! | 5 days ago you wrote:
"DIST_RT is a float."
http://forums.teradata.com/forum/database/desperately-need-ur-help#comment-11190
If you changed it to integer/decimal just change it back to FLOA... |
737 | 27 May 2010 @ 03:13 PDT | Database | Reply | Desperately need ur help! | This query just mops the floor, it's better to fix the leak.
1. Make B.DIST_RT a FLOAT
2. remove all the CASTs, thus DST_CNT will be a float, too
3. COALESCE(CAST(SUM(CNT_tasks) OVER (PAR... |
736 | 26 May 2010 @ 02:18 PDT | Database | Reply | Desperately need ur help! | Keep DST_CNT as a float and cast to decimal in the last step.
Dieter |
735 | 26 May 2010 @ 01:34 PDT | Database | Reply | Desperately need ur help! | It's supposed to work, add a TYPE(DST_CNT) to see if DST_CNT really a float.
Dieter |
734 | 26 May 2010 @ 12:44 PDT | Database | Reply | Desperately need ur help! | Ok, finally remove the cast and apply it to both moving sums of the outer query:
CAST(SUM(CNT_tasks)
OVER (PARTITION BY hierarchy
ORDER BY CNT_tasks
ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRE... |
733 | 26 May 2010 @ 11:25 PDT | Database | Reply | Desperately need ur help! | Oops, copied the wrong query, cast to DECIMAL instead of INTEGER
Dieter |
732 | 26 May 2010 @ 08:33 PDT | Database | Reply | Optimizer Lies :) | For the table you created you don't need that partition, it's totally useless (just creates a larger table).
Partitioning is best on columns which are used a lot in WHERE, but a PI only on that ... |
731 | 26 May 2010 @ 08:15 PDT | Database | Reply | Desperately need ur help! | I don't get it, but it sounds like you have to add another derived table:
SEL team,hierarchy,
CAST(a.TOT_CNT * B.DIST_RT / SUM(B.DIST_RT) OVER (PARTITION BY B.TA_HIER_NUM) AS INTEGER) CNT_tasks... |
730 | 21 May 2010 @ 02:03 PDT | Database | Reply | Desperately need ur help! | Is there really a fractional part in B.DIST_RT?
Try casting to a DEC instead of INT:
sel hierarchy, TOT_CNT ,
sum(CNT_tasks) over (partition by hierarchy) as x,
from
(
SEL team,hierarchy,a.... |
729 | 21 May 2010 @ 12:32 PDT | Database | Reply | Desperately need ur help! | What's the datatype of DIST_RT?
Try following query to see the wrong values:
sel hierarchy, TOT_CNT ,
sum(CNT_tasks) over (partition by hierarchy) as x,
from
(
SEL team,hierarchy,a.TOT_... |