system-determined change threshold for Stats-- Teradata - response (1) by dins2k2
Data type does not match a Defined Type name error - forum topic by Nikhil_Teradata
Hi I have below piece of code
DATABASE ndeshpande; SELECT DISTINCT Click.Pgm_Cd ,Click.Send_Job_ID , Click.Send_URL_Id , Click.ET_Subscr_Key , Click.URL_Val , CASE WHEN Click.URL_Val LIKE '%artist%' THEN SUBSTR (Click.URL_Val, INDEX(Click.URL_Val,'artist/')+7, 10 ) ELSE NULL END , CASE WHEN Click.URL_Val LIKE '%event%' THEN SUBSTR (Click.URL_Val, INDEX(Click.URL_Val,'event/')+6, 16) ELSE NULL END ,Click.Email_Addr_Txt ,Patron.patron_id ,patron.Patron_Lkup_ID ,click.click_dttm FROM VW_ClickPref_DataLoad AS Click INNER JOIN pextgvw.et_patron_LN AS patron ON click.ET_Subscr_Key = CAST (patron.et_subscr_id AS VARCHAR(50)) AND patron.PGM_Cd = Click.PGM_Cd LEFT OUTER JOIN VW_ClickPref_URLExtract AS ex ON ex.Email_Addr_Txt = Click.Email_Addr_Txt AND ex.Send_Job_ID = Click.Send_Job_ID WHERE ex.Email_Addr_Txt IS NULL;
and it is giving me the error mentioned below:
Select Failed. [3706] Syntax error: Data type "P" does not match a Defined Type name.
I am not seeing this issue anywhere. Can someone please help me identify the issue here?
-Nik
Sessions used by load utilties - forum topic by spbalu
We are on teradata 14.10.
Is there any query to find out number of sessions used by Load Utilities (Fastload, Multiload, TPTUpdate, Load) by looking at the DBQLOGTBL?
Thanks in advance
program to retrieve datbase table names - response (1) by Fred
So you are using CLIv2 in a C/C++ application? Under the cliv2 install directory is a clisamp directory with source for a sample program.
After the DBFIRQ (Initiate Request) call with a data-returning statement, you make one or more DBFFET (Fetch) calls to retrieve data, and then should make a DBFERQ (End Request) call to indicate you are done with the response.
Sessions used by load utilties - response (1) by Fred
Not by looking at DBQLogTbl / QryLogV alone (even in later releases). In TD15.0 and later you can optionally collect that information in DBQLUtilityTbl / QryLogUtilityV. In prior releases you would need to look at LogOnOffV (EventLog) to see how many sessions log on with the same LSN.
program to retrieve datbase table names - response (2) by atesting
Hi,
Yes i am using CLIv2 in a C/C++ application.
After the DBFIRQ (Initiate Request) call with a data-returning statement, it returns metadata of DBC.TABLES with column TABLENAME, tablekind description. On making call to DBFFET (Fetch), it returns resp_ buf_len with 2 bytes and dbcarea_->fet_parcel_flavor value set to pclENDSTATEMENT. It returns no response.
Data type does not match a Defined Type name error - response (1) by Nikhil_Teradata
Ok. Now this is getting weird.
I am getting this error for any piece of code I write.. Please help.
program to retrieve datbase table names - response (3) by atesting
Hi,
I could not find the clisamp directory, could you please send me link to it.
Looking for help on full teradata database backup and restore steps. (preferably DSA-Netbackup) - forum topic by Washim N
Hello All,
I'm looking for help on full database backup and restore steps, which includes DBC, All users , accessrights , functions, procedures, Data, Join Indexes etc. to make the database back to normal.
I'm currently using DSA-Netbackup but any general BAR best practices/guidelines would help. Thanks
Count rows for every x minute interval - forum topic by tera_maria
I am new to teradata and to this forum. We use a tool called Business Objects (MyInsight) to query a teradata reporting database. I am trying to run a query that will count rows per every 30 minute interval. Here is the very basic query:
SELECT
trim(cast(BI_DMV.IVR_CALL_LOG.CALL_TM_MAN as varchar(20))),
count(*)
FROM
BI_DMV.IVR_CALL_LOG
WHERE
BI_DMV.IVR_CALL_LOG.CALL_DT IN ( {d '2016-02-13'} )
GROUP BY
1
It's output look like this:
Detail Call Time
Call Count
00:00:00
2
00:00:01
1
00:00:02
3
00:00:03
4
00:00:04
1
00:00:06
1
00:00:07
1
00:00:08
1
00:00:09
1
00:00:10
1
00:00:11
1
00:00:12
1
00:00:13
2
00:00:14
5
00:00:15
2
How can I modify my query so that the call count is for every 30 minutes? So in my pretend output below, the 00:00 row, the call ount is really a count from 12am to 12:30, the 00:30 row is really a countr from 12:30am to 1am and so on and so forth?
Detail Call Time
Call Count
00:00
30
00:30
40
01:00
50
01:30
400
Please help! A little desparate here, I am not finding much when I google search; none that I can understand anyway.
Thanks in advance!!
need to test a query using three diff dates - forum topic by nambir
Hi,
i want to test my query on three different dates .Either it takes the dates during run time or pick three defined dates.
I am not sure if recursive will help in here as I have not used it before.
Can someone help me on this?
Thanks
Count rows for every x minute interval - response (1) by dnoeth
You can use following calculation to truncate a timestamp to half hour intervals:
TS - ((EXTRACT(MINUTE FROM TS) MOD 30) * INTERVAL '1' MINUTE + EXTRACT(SECOND FROM TS) * INTERVAL '1' SECOND)
need to test a query using three diff dates - response (1) by dnoeth
It's hard to help without knowing what you try to do.
You need to add more details including some sample data and expected result...
Query to remove some characters from a column - response (1) by stevebarry
Hi,
You can replace %[ with OReplace, but you will need to use a regular expression in conjunction with REGEXP_REPLACE to remove the ]Q1_1%.
Here is the code to handle the example above:
SELECT
'have your %[hidden_prod_class_desc]Q4_1% serviced by %[hidden_bo_name]Q3_1%
have your %[hidden_desc]Q14_1% serviced by %[hidden_bo_name]Q9_1%' original_string,
REGEXP_REPLACE(
OREPLACE(original_String,'%[','['), -- string to process,OREPLACE to replace the %[ with [
'\]Q[0-9]+_[0-9]+%', -- regular expression to look for ]Q<some numbers>_<some numbers>%
']', -- string to replace it with
1, --start position
0, -- 0 = replace all occurences
'i' -- case insensitive
)
Regards,
Steve.
Query to remove some characters from a column - response (2) by dnoeth
You might also get rid of the oReplace by using three capturing groups within the regex: replace all three groups by the 2nd:
REGEXP_REPLACE(original_String , '(%)(\[.+?\])(Q[0-9]+_[0-9]+%)', '\2', 1, 0, 'i')
DSA Restore Job failing with Errorcode: 2640 Errormsg: "Specified table does not exist in All" - forum topic by Washim N
The DSA Back-up job was succuessful, but when I try to restore it from the same it gives the error: 2640 : " Specified Table does not exist in ALL".
Did anyone encountered this before? Looking for a root cause and solution for this issue.
ResUsageSAWT Time Interval - forum topic by brokenp87
Hi all,
I have a particular question regarding how the data are stored inside ResUsageSAWT.
When the column TheTime is for example '04:10:00.00' all the data regarding AWTs refers to the interval from 04:00 to 04:10 or refers to the interval 04:10 to 04:20?
Thanks in advance for your help!
ResUsageSAWT Time Interval - response (1) by CarlosAL
Hi.
Time is time. It's the moment when the information is logged. The period is typically determined by the information in "Secs", "CentiSecs"...
HTH.
Cheers.
Carlos.
program to retrieve datbase table names - response (4) by Fred
DBFCON returns a status parcel. Did you close the Connect request before the DBFIRQ?
Have you checked DBQL to verify that the statement was sent to the database and executed?
On Unix / Linux there is a shared code sample directory /opt/teradata/client/vv.vv/sample
On 64-bit Windows, there is a separate ...\CLIv2\clisamp
The sample program is clisamp.c
Data type does not match a Defined Type name error - response (2) by Fred
Try pasting the SQL into Notepad, then copy the "plain text" version and paste it back into SQL Assistant.
Chirag,
Cut from one of the Carrie's blog. Check this link for detailed Statistics Threshold Functionality on TD 14.10.
https://developer.teradata.com/blog/carrie/2014/02/statistics-threshold-functionality-101
All 14.10 systems have the system threshold functionality turned on by default. But by itself, that is not enough. USECOUNT logging for the database must also be enabled. If USECOUNT DBQL logging is turned on, then each COLLECT STATISTICS statement will be evaluated to see if it will run or be skipped.
During this evaluation, an appropriate change threshold for the statistic is established by the optimizer. The degree of change to the table since the last collection is compared against the current state of the table, based on USECOUNT tracking of inserts, deletes and updates performed. If the change threshold has not been reached, and enough history has been collected for this statistics (usually four of five full collections) so that the optimizer can perceive a pattern in the data such that extrapolations can be confidently performed, then this statistics collection will be skipped.
Even if the percent of change threshold has not been reached (indicating that statistics can be skipped), if there are insufficient history records, the statistics will be recollected. And even with 10 or 20 history records, if there is no regular pattern of change that the optimizer can rely on to make reasonable extrapolations, statistics will be recollected.
There is a DBS Control record parameter called SysChangeThresholdOption which the behavior of the system threshold functionality. This parameter is set at zero by default. Zero means that as long as USECOUNT logging in DBQL is enabled for the database that the table belongs to, then all statistics collection statements will undergo a percent of change threshold evaluation, as described above.
If you want to maintain the legacy behavior, threshold logic can be turned off completely at the system level by disabling the SysChangeThresholdOption setting in DBS Control (set it to 3). This field, along with parameters to set DBA-defined global parameters, can be found in the new Optimizer Statistics Fields in DBS Control.
It is important to re-emphasize that the DBQL USECOUNT logging must be enabled for all databases that you want to take advantage of the system threshold functionality. In addition, all other lower-level threshold settings must remain off (as they are by default) in order for the system threshold to be in effect.
Thanks,
Dinesh