953 | 06 Apr 2011 @ 01:36 PDT | Analytics | Reply | SELECT Failed. 3706: Syntax error: expected something between '(' and the 'select' keyword. | A huge CASE just looks ugly, but it's probably the most efficient way, so i'd stick with it for much more than 10 categories.
I once wrote a batch which created a nested case with a few thousand v... |
952 | 06 Apr 2011 @ 01:21 PDT | UDA | Reply | Difference in output | The first select within a set operation determines a column's data type.
The "NULL (VARCHAR(2000))" results in a LATIN character set:
SELECT TYPE (NULL (VARCHAR(2000))), TYPE('' (VARCHAR(2000))... |
951 | 01 Apr 2011 @ 06:57 PDT | Analytics | Reply | SELECT Failed. 3706: Syntax error: expected something between '(' and the 'select' keyword. | Looks like you want the max of three columns.
Your query is overly complex, you don't need any Scalar Subquery or Left Join to get the result set:
SELECT id,
CASE
WHEN category_1 > cate... |
950 | 01 Apr 2011 @ 06:30 PDT | General | Reply | Error code 3180 ? | Hi Didier,
also from the Messages manual:
Remedy: Contact your Support Representative
Open an incident
Dieter |
949 | 30 Mar 2011 @ 11:06 PDT | Database | Reply | counter that resets at each new customer account record | select acc_no,
row_number() over (partition by acc_no order by ??)
from tab
Dieter |
948 | 30 Mar 2011 @ 10:54 PDT | Database | Reply | USI vs Primary key to enforce uniqueness | Oops, you're right, you better don't resubmit that query.
If you didn't do it already you should open an incident, this is a severe problem.
Dieter |
947 | 28 Mar 2011 @ 11:53 PDT | Database | Reply | USI vs Primary key to enforce uniqueness | Do you actually need the USI?
Do you access it in WHERE?
If it's only for the logical uniqueness, it's hopefully already checked in your ETL process:
Inserting 50 million rows with just a sing... |
946 | 28 Mar 2011 @ 11:44 PDT | Tools | Reply | Fastexport data Display | Why do you need that?
Is it so hard to find out where's the start and the end of a file? ;-)
The only way i know is to add another select:
select top 1 'START OF FILE' from dbc.dbcinfoV;
y... |
945 | 28 Mar 2011 @ 11:32 PDT | Database | Reply | Teradata Table Naming | The maximum length of a name was 18 according to old Standard SQL, so 30 was much more than that.
The system tables are already prepared for VARCHAR(128), so a future release will change this limi... |
944 | 28 Mar 2011 @ 11:25 PDT | Database | Reply | TPT - TIMESTAMP FORMAT - century of '19' instead of '20' | Reminds me of "year 2k" :-)
There's only a global setting (dbscontrol global field 14: CenturyBreak), but no session local setting.
Why don't you simply concat '20' to the timestamp and chang... |
943 | 28 Mar 2011 @ 08:30 PDT | UDA | Reply | Colstats privileges??? | You just have to concat a "collect stats" string and submit it using dbc.SsyExecSQL like:
REPLACE PROCEDURE collectstats (IN DatabaseName VARCHAR(30), IN TableName VARCHAR(30), IN ColumnList VARCH... |
942 | 28 Mar 2011 @ 07:55 PDT | Database | Reply | teradata update syntax | What means "is not working"?
Could you please post the query you tried?
Dieter |
941 | 28 Mar 2011 @ 07:52 PDT | General | Reply | Error Code 3785 | Hi Annie,
your first where-condition is wrong:
prodvm.balance_adjustment.adjustment_reason_code = ('B', 'C')
The parser expects:
prodvm.balance_adjustment.adjustment_reason_code = ANY ('B', '... |
940 | 26 Mar 2011 @ 09:13 PDT | UDA | Reply | Colstats privileges??? | No in TD12, in TD13 there's a new STATISTICS right.
Of course you can easily encapsulate the COLLECT STATS in a Stored Procedure using Dynamic SQL. Then developers don't need specific rights.
... |
939 | 23 Mar 2011 @ 02:11 PDT | Database | Reply | Converting a TIMESTAMP(6) to a TIMESTAMP(0) for Insert | There's no easy way to truncate a TimeStamp :-(
Using an intermediate string:
CAST(SUBSTRING(CAST(x AS CHAR(26)) FROM 1 FOR 19) AS TIMESTAMP(0))
or
CAST(CAST(x AS DATE) AS TIMESTAMP(0))
... |
938 | 23 Mar 2011 @ 02:00 PDT | Database | Reply | Can't use count with in a view... | There are two ways to rewrite your query using Standard SQL, although both will result in a slightly different output.
#1:
SELECT A1.CUSTOMER_BAN AS "BAN"
,A1.CREATOR_USERNM AS "USERNM"
,COUN... |
937 | 23 Mar 2011 @ 10:30 PDT | Tools | Reply | ERROR : **** 19:13:12 UTY0805 RDBMS failure, 5407: Invalid operation on an ANSI Datetime or Interval | Hi Anil,
AAA is an ODBC setting, it doesn't matter in MLoad.
MLoad only uses CLI, but never ODBC, that's why i asked.
If you don't set FORMAT it defaults to binary FASTLOAD format, but you nee... |
936 | 23 Mar 2011 @ 10:22 PDT | UDA | Reply | Formatting decimal fields while exporting | What about -0.23000?
-.23:
TRIM(TRAILING '0' FROM col (FORMAT '-(4).9(8)')) || CASE WHEN col MOD 1 = 0 THEN '0' ELSE '' END
-0.23?
TRIM(TRAILING '0' FROM col (FORMAT '-(3)9.9(9)')) || CASE... |
935 | 23 Mar 2011 @ 12:20 PDT | Tools | Reply | ERROR : **** 19:13:12 UTY0805 RDBMS failure, 5407: Invalid operation on an ANSI Datetime or Interval | Hi Anil,
some questions:
- MLoad using ODBC connection?
- is the input file binary data or readable text?
- fixed or variable text?
- which FORMAT and DATEFORM setting is used in MLoad?
Dieter |
934 | 23 Mar 2011 @ 12:13 PDT | Database | Reply | Index selection | In your case PPI access is always faster than VOSI.
But performance might degrade for joins and where conditions without the partitioning column if that column is not also part of the PI.
You... |
933 | 22 Mar 2011 @ 11:59 PDT | Database | Reply | Looking for View Definition in DBC table | RequestText is the original source code "as is" including comments:
SHOW SELECT * FROM VIEW
When a view is created then this source code is parsed, object names are resolved and stored in Crea... |
932 | 22 Mar 2011 @ 06:49 PDT | Database | Reply | Index selection | Of course it access will be faster when you partition the tables instead of a VOSI.
But you must be carefull when accessing the 2nd table without the date column, this will be much slower than b... |
931 | 22 Mar 2011 @ 06:45 PDT | Database | Reply | Hash Index and PPI | Hi Kishore_1,
maybe you misread the manuals:
Of course you can create a Hash Index on a partitioned table, you can't partition a HI.
I really don't understand the meaning of the second post..... |
930 | 22 Mar 2011 @ 06:40 PDT | Database | Reply | query | Hi srivalli,
select a.acc_no,
a.balance + b.cumulative_sum
from table_a as a
join
(select acc_no,
sum(amt) over (partition acc_no
order by datecol
rows unbounded preceding) as cumul... |
929 | 18 Mar 2011 @ 11:43 PDT | Database | Reply | Convert DB2 date to Teradata date. | I'm not shure why your query fails, but when you write the date in the correct way it works as expected:
SELECT *
FROM tmp_db2_dt
WHERE CAST(db2_dt AS DATE FORMAT 'ddMMMyyyy') < date '2000-01-... |