Logon credentials in BTEQ script not working - response (2) by DZanke
Select Failed 2666 Invalid date supplied - forum topic by shaves
SELECT
'D' || A.ZARF_ECARS_1 || A.legacy_branch_rented as Transmittal_Number,
A.ADDRESS1 as Address,
A.CITY as CITY1,
A.STATE as STATE1,
A.POSTAL as ZIP,
A.ITEM as Debtor_Reference,
cast(A.due_DT as date format 'MM/DD/YYYY') as DueDt,
A.BAL_AMT as Amount_Due,
cast(a.zarf_ecars_1 as decimal(6,0)) as LTicket,
cast(max(b.accounting_dt) as date format 'MM/DD/YYYY') as PSLastPay
FROM PSFS.BWS_CUST_AR_MAST A
left outer join psfs.BWS_CUST_AR_MAST_ACTIVITY b on a.item=b.item and b.ENTRY_TYPE='PY'
where a.business_unit='D9001'
and a.cust_field_c2='S'
and cast(A.asof_DT as date format 'MM/DD/YYYY') between
cast( '01/01/2016 00:00:00' as date format 'MM/DD/YYYY') and
cast( '01/31/2016 00:00:00' as date format 'MM/DD/YYYY')
and a.bal_amt>0
group by
Transmittal_Number,
Address,
CITY1,
STATE1,
ZIP,
Debtor_Reference,
DueDt,
Amount_Due,
LTicket
When I try to run this sql, I get an error message that says "Select Failed. [2666] Invalid date supplied for BWS_CUST_AR_MAST asof_dt. This column is defined as TIMESTAMP (0). Any help would be greatly appreciated. I'm not sure what is more confusing dates or the CAST feature. thanks for your help
cast date between 2 different data types - response (2) by shaves
select
cast (cast (jsdate as Char (8)) as date format 'yyyymmdd') as Date_Col,
jsdate,
jsn,
junit,
jmyear,
jmake,
jmodel,
jseries,
jbuyid
from veh_mgmt_as400.cs087p
where jfinowngp = 'p1'
and jfinownbr = '99'
and date_col between '06/01/2015' and '01/31/2016'
Carlos...........Thanks for looking at this. My sql is above and I tried to incorporate your suggestions but I obviously missed something becuase I'm getting a "Select Failed. [2666] Invalid date supplied for CS087P.JSDATE. This is a pretty simple query but dates and cast make me crazy. Thanks for your help
Help with stored procedure metadat - forum topic by sateeshgbn
I want to extract meta data for stored procedure from dbc tables something like this.
select
a.name AS [ParameterName],
a.parameter_id AS [ParameterID],
TYPE_NAME(a.user_type_id) AS [ParameterDataType],
a.max_length AS [ParameterMaxBytes],
a.is_output AS [IsOutPutParameter]
from
sys.parameters a
;
Disable TD2 logon but allow LDAP for certain users - response (5) by Fred
If they don't know the password, they can't use TD2 authentication. The issue is that someone could potentially authenticate via LDAP, then change their TD2 password, and they subsequently would be able to use TD2 successfully. But you can set a combination of password controls in the user profile that is impossible to satisfy, which will prevent the users from changing their TD2 password.
td wallet for jdbc - response (4) by tomnolan
It is still the case that, at the present time, there is no interoperability between Teradata Wallet and the Teradata JDBC Driver.
We are in the planning stage for a new Teradata JDBC Driver feature, to enable the use of passwords stored in encrypted files. The initial release of that feature is not likely to interoperate with Teradata Wallet; however, interoperability may be possible in a future release.
DECODE Does Not Trap Divide by Zero Error - forum topic by ssi112
I've been beating my head against Teradata's wall this week and cannot figure out why this isn't working. We use this code in Oracle and recently ported data over to Teradata. The CASE and DECODES are as is from Oracle, however, unlike Oracle I get 2618 invalid calculation, division by zero.
Why does this work in Oracle and not teradata?
Note there are 39 formula keys (1...39) and 1, 2 & 3 are the simplist. It fails on 2 and 3. I figure if I can understand how Teradata is evaluating this and not capturing the division by zero on 2 and 3 then I can probably figure out the remaining formulas.
Thanks
CASE
WHEN rl.formula_key = 1
THEN SUM (DECODE (variable_code,'V1', CurrentActualAmount,0))
WHEN rl.formula_key = 2 -- V1 / V2
THEN DECODE ((SUM(DECODE(variable_code, 'V2', CurrentActualAmount, 0))), 0, 0, (SUM (DECODE (variable_code, 'V1', CurrentActualAmount, 0)) / SUM (DECODE (variable_code, 'V2', CurrentActualAmount, 0))))
WHEN rl.formula_key = 3 -- (V1/V2)*100
THEN DECODE((SUM(DECODE(variable_code, 'V2', CurrentActualAmount, 0))), 0, 0, ((100 * SUM(DECODE(variable_code, 'V1', CurrentActualAmount, 0)) / SUM(DECODE(variable_code, 'V2', CurrentActualAmount, 0))) ))
ELSE 0
END AS actual_amount
Block Level Compression (BLC) - forum topic by caitken4me
Working with a customer who is moving from TD13.10 to TD15 and also moving from an appliance 2650 to a 2800. The data will be moved via NPARC and all tables will land on the new system in compressed (BLC) format. Question is, would it make sense to alter all the datablocksizes of the large tables to 255 sectors (130,560 bytes) prior to the NPARC to obtain the optimal compression on the new platform. Almost all the tables on the current system are set at the default of 127 sectors. Looking for guidance from anyone that has gone through this exercise. Chet
Select Failed 2666 Invalid date supplied - response (1) by dins2k2
Hi Shaves,
Hope this helps.
cast(A.asof_DT as date) between cast(cast( '2016-01-01 00:00:00' as timestamp(0)) as date) and cast(cast( '2016-01-31 00:00:00' as timestamp(0)) as date)
Thanks,
Dinesh
Column with keywords found in comments field - forum topic by harrytuttle
At work I've been given a task that I'm told is "simple and straightforward", but I'm having difficulty with:
I have a view that contains 4 columns, a PK, FK, comments, and column #4. My manager is telling me to make a separate table that contains 75 or so keywords, and then a query that will go through each row in the view, compare the comments to the keyword table, and then append each found keyword to column #4. I've searched google and SO, and have not found a query that would do this, and haven't been able to figure out a way to do this myself beyond a lot of case and index statements, which I end up running into spool issues with. Any help would be appreciated.
Create Table Using SELECT Statement With Default User and Date - forum topic by DRossmann
I'm trying to create a table, using a SELECT state, but that also has the LOAD_USER and LOAD_DATE with defaults to CURRENT_USER and CURRENT_TIMESTAMP. If I was creating the table, then adding the data, the text for the two fields would be;
ADD LOAD_USER2 CHAR(20) CHARACTER SET LATIN CASESPECIFIC DEFAULT USER,
ADD LOAD_DATE2 TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6)
However, I can't figure out using a SELECT statement. For example;
CREATE TABLE
DATA_TABLES.TABLE_TEST
AS
(SELECT
'Mickey Mouse' AS NAME
,CURRENT_USER AS LOAD_USER
,CURRENT_TIMESTAMP AS LOAD_DATE
)
WITH DATA
This will put the current user and date in the fields, but the fields are not set to default them going forward.
DECODE Does Not Trap Divide by Zero Error - response (1) by dins2k2
Steve,
DECODE is very complex. You can convert DECODE into CASE statements.
For capturing division by zero, you can use NULLIF or NULLIFZERO functions.
Thanks,
Dinesh
DECODE Does Not Trap Divide by Zero Error - response (2) by dnoeth
DECODE is not built-in, but a UDF. It's probably not following the same rules as a CASE, i.e. seems to calculate everything before deciding which value to return.
The only workaround might be adding NULLIF for division:
/ NULLIF(SUM (DECODE (variable_code, 'V2', CurrentActualAmount, 0)),0)
But then you don't need the outer DECODE anymore, after switching to CASE:
CASE WHEN rl.formula_key = 1 THEN SUM(CASE WHEN variable_code = 'V1' THEN CurrentActualAmount ELSE 0 END) WHEN rl.formula_key = 2 -- V1 / V2 THEN COALESCE(SUM(CASE WHEN variable_code = 'V1' THEN CurrentActualAmount ELSE 0 END) / NULLIF(SUM(CASE WHEN variable_code = 'V2' THEN CurrentActualAmount ELSE 0 END),0) ,0) WHEN rl.formula_key = 3 -- (V1/V2)*100 THEN COALESCE(100 * SUM(CASE WHEN variable_code = 'V1' THEN CurrentActualAmount ELSE 0 END) / NULLIF(SUM(CASE WHEN variable_code = 'V2' THEN CurrentActualAmount ELSE 0 END),0) ,0) ELSE 0 END AS actual_amount
Select Failed 2666 Invalid date supplied - response (2) by dnoeth
There's no need for CASTs, better use DATE/TIMESTAMP literals:
and cast(A.asof_DT as date) between DATE '2016-01-01' AND DATE '2016-01-31'
or simplified to:
and A.asof_DT between TIMESTAMP '2016-01-01 00:00:00' AND TIMESTAMP '2016-01-31 23:59:59'
Create Table Using SELECT Statement With Default User and Date - response (1) by dnoeth
You can add constraints to the CREATE like
CREATE TABLE TABLE_TEST (NAME, LOAD_USER CASESPECIFIC DEFAULT USER, LOAD_DATE DEFAULT CURRENT_TIMESTAMP(6) ) AS (SELECT 'Mickey Mouse' AS NAME ,TRANSLATE(CURRENT_USER USING unicode_to_latin) AS LOAD_USER ,CAST(CURRENT_TIMESTAMP AS TIMESTAMP) AS LOAD_DATE ) WITH DATA
But then it's quite similar to a seperate CREATE TABLE followed by a INSERT/SELECT...
No menu bar in SQL Assistant 14.01 - response (3) by Fred
From a command prompt:
del "%APPDATA%\Teradata\SQL Assistant\Toolbars.config"
Next time you run SQL Assistant, it will re-create the file with default settings.
Access Right Abbreviations - response (7) by climbamtn
How about the following:
OA
OR
Access Right Abbreviations - response (8) by dins2k2
Hi,
OA = OVERRIDE DUMP CONSTRAINT
OR= OVERRIDE RESTORE CONSTRAINT
Below link has all the privilege codes.
http://www.info.teradata.com/htmlpubs/DB_TTU_14_10/index.html#page/Database_Management/B035_1100_112A/AppB.123.08.html
Thanks,
Dinesh
Access Right Abbreviations - response (9) by Fred
See the Appendix in the Data Dictionary Manual.
OA = Override Dump
OR= Override Restore
RDBMS error 3813: The positional assignment list has too many values - forum topic by 31_resu
Hello, I'm building a TPT script to load a flat file to a table. I'm running it from the command line:
tbuild -f c:\some_dir\tpt_load.txt
My Teradata platform system is: VERSION 14.00.07.15 RELEASE 14.00.07.16
Below is my code dummied up. I'm loading 109 columns of data. The below is as identical as the original, minus all the col names and their commas , etc. The error message suggests that I have a misplaced comma, or the error is in the insert somewhere. I have compared the columns of the target table, to Schma, the Apply, and the Insert, and they align count per count and by row/co, they have their commas, colons, paranthesis, all in the right places an accounted for. So I'm getting the impression that error is misleading and it's bad syntax somewhere other than a column alignment by commas as 3813 is suggesting. Any ideas on what I can try or provide to help resolve? Thank you.DEFINE JOB LOAD_TPT_STUFF
DESCRIPTION 'LOAD TERADATA TABLE FROM FLAT FILE'
(
DEFINE SCHEMA FFILESCHEMA
DESCRIPTION 'DB.TableName'
(
col_indx VARCHAR(255)
, StartTime VARCHAR(255)
, Thing VARCHAR(255)
) ;
DEFINE OPERATOR DATACONNECTION
DESCRIPTION 'TPT CONNECTIONS OPERATOR'
TYPE DATACONNECTOR PRODUCER
SCHEMA FFILESCHEMA
ATTRIBUTES
(
VARCHAR PrivateLogName = 'tpt_stuff_raw1.log'
, VARCHAR DirectoryPath = 'c:\some_dir\'
, VARCHAR FileName = 'data*.csv'
, VARCHAR Format = 'Delimited'
, VARCHAR TextDelimiter = ','
, VARCHAR OpenMode = 'read'
) ;
DEFINE OPERATOR INSERT_TPT_STUFF
DESCRIPTION 'TPT INSERT OPERATOR'
TYPE INSERTER
SCHEMA *
ATTRIBUTES
(
VARCHAR PrivateLogName = 'tpt_stuff_raw2.log'
, VARCHAR TdpId = '127.0.0.1'
, VARCHAR UserName = 'userid'
, VARCHAR UserPassword = 'password'
, VARCHAR TargetTable = 'db.tablename'
, VARCHAR LogTable = 'db.tablename_log'
, VARCHAR ErrorTable1 = 'db.tablename_err1'
, VARCHAR ErrorTable2 = 'db.tablename_err2'
) ;
APPLY
( 'INSERT INTO db.tablename
(
:col_inds
,:StartTime
,:Thing
);
')
TO OPERATOR (INSERT_TPT_CHAT[8])
SELECT
col_indx
, StartTime
, Thing
FROM OPERATOR
(DATACONNECTION[8]) ;
) ;
Here is a segment of the error:
(...)
DATACONNECTION[1]: TPT19222 Operator instance 1 processing file 'c:\some_dir\data_date.csv'.
INSERT_TPT_STUFF: connecting sessions
INSERT_TPT_STUFF: The RDBMS retryable error code list was not found
INSERT_TPT_STUFF: The job will use its internal retryable error codes
INSERT_TPT_STUFF: TPT10508: RDBMS error 3813: The positional assignment list hastoo many values.
INSERT_TPT_STUFF: TPT10508: RDBMS error 3813: The positional assignment list hastoo many values.
INSERT_TPT_STUFF: TPT10508: RDBMS error 3813: The positional assignment list hastoo many values.
INSERT_TPT_STUFF: TPT10508: RDBMS error 3813: The positional assignment list hastoo many values.
INSERT_TPT_STUFF: TPT10508: RDBMS error 3813: The positional assignment list hastoo many values.
INSERT_TPT_STUFF: TPT10508: RDBMS error 3813: The positional assignment list hastoo many values.
INSERT_TPT_STUFF: TPT10508: RDBMS error 3813: The positional assignment list hastoo many values.
INSERT_TPT_STUFF: TPT10508: RDBMS error 3813: The positional assignment list hastoo many values.
INSERT_TPT_STUFF: Total Rows Sent To RDBMS: 0
INSERT_TPT_STUFF: Total Rows Applied: 0
INSERT_TPT_STUFF: disconnecting sessions
INSERT_TPT_STUFF: Total processor time used = '2.24641 Second(s)'
INSERT_TPT_STUFF: Start : Wed Feb 03 16:10:58 2016
INSERT_TPT_STUFF: End : Wed Feb 03 16:10:59 2016
DATACONNECTION[1]: TPT19221 Total files processed: 0.
Job step MAIN_STEP terminated (status 12)
Job userid terminated (status 12)
Thanks for the tip. I did try passing the password in batch mode using various combinations of quotes/no quotes on both the password and userid. It turns out that I loacked the account during these tries but didn't know that because I still received the same invalid user/account message.