36 | 12 Apr 2014 @ 10:31 PDT | UDA | Reply | Cast and format | Hi,
SELECT
CLI.A40_CLNT_LCL_ID, CLI.A4_CORP_NAME, CLI.CD_SAE, CLI.CD_RAE, CLI.MERC, CLI.COD_MDLL
, CLI.COD_MOTIVAZ, CLI.DT_RFRM,
cast(otranslate(NER.DT_FNE_VLD_RAT,'.','-') as... |
35 | 09 Apr 2014 @ 01:22 PDT | Database | Reply | Rounding Number | Hi,
SEL CAST('1.985' as DECIMAL(10,0)
If you try to cast it to Decimal, it will round the value. I am not sure of CEIL function.
Thanks & Regards,
Adharssh.
|
34 | 07 Apr 2014 @ 07:27 PDT | Database | Reply | Is there an equivalent to the FIRST function? | Hi,
I am not sure about the exact date column here. From what you have told, it seems that you need the distinct number of Incident Id and if there are duplicates on it, we should take the inciden... |
33 | 07 Apr 2014 @ 07:06 PDT | Database | Reply | IS NOT IN Syntax |
Hi Ravi,
There is no syntax called 'IS NOT IN'. We have NOT IN or IN. Please find the Correct Code.
SELECT t1.c1 ,
CASE WHEN t1.c2 IS NOT N... |
32 | 04 Apr 2014 @ 11:53 PDT | Database | Reply | Date as Integer | Hi,
The Update Statement followed by an insert statement will work.
Update B
from A ST
Set Efftctive_Date_tb=current_date
where st.client_id=B.clienid_pk and
(ST.business <>B.business... |
31 | 04 Apr 2014 @ 11:42 PDT | Database | Reply | ROW_NUMBER() same values | Hi Tamil,
Can you post some sample valyes. Couldn't get the result from the sample that you have pasted.
Thanks & Regards,
Adharssh.
|
30 | 04 Apr 2014 @ 11:39 PDT | Database | Reply | Can Decimal and Integer be a mismatch for Join? | Thanks Dieter for the Explanation and thanks Dominiq. Yes Trailing Spaces will be ignored.
Thanks,
Adharssh.
|
29 | 04 Apr 2014 @ 11:36 PDT | Database | Reply | ROW_NUMBER() same values | Hi Fazol,
You can use the Rank Function.
select<table>.*
RANK() OVER(PARTITION BY col1 ORDER BY col2) from <table>
Thanks & Regards,
Adharssh Rao.
|
28 | 03 Apr 2014 @ 06:44 PDT | Database | Reply | Can Decimal and Integer be a mismatch for Join? | Hi Dieter,
Till Now i was in the perception that if we define the Character data type, then we should use TRIM to avoid the trailing Spaces.
When we use CHAR_LENGTH function, it returns the total... |
27 | 02 Apr 2014 @ 09:25 PDT | Database | Reply | No More Spool Space issue encountered. | Hi,
Spool Space will be allocated to each User. The actual query what we intended to do might have more I/O operations involved. Since you have Spilted the query with more than 2 to 3 steps.... |
26 | 02 Apr 2014 @ 09:12 PDT | Database | Reply | Getting average using inbuilt Teradata functions | Hi Aarsh,
There is a inbuilt function called 'AVG', which will do the average function.
SELECT
AVG(start_tm) from DB_NAME.TBL_NM
where trunc(start_ts) >= (current_date-30) ) as Ave... |
25 | 02 Apr 2014 @ 09:02 PDT | Database | Reply | Row logging into ET table | Hi ,
Are you sure that this was the Table structure that you gave, there was a missing Column between CODE & DESC columns.
Thanks & Regards,
Adharssh.
|
24 | 02 Apr 2014 @ 07:21 PDT | Database | Reply | To UNION OR Not to UNION | Hi,
First of all does the INCIDENT_ID from the Warning table and the BUREAU_ID from the Bureau table are the same, if they are the same. You can use only one query alone. Or else you can use this ... |
23 | 01 Apr 2014 @ 11:29 PDT | Database | Reply | Can Decimal and Integer be a mismatch for Join? | Hi,
1. Can Decimal(12,0) and integer be a mismatch for join?
--> Answer would be No. There won't be mismatch of data values. Since 10.00 is same as 10
2. Can Decimal(10,0) and Decimal(20... |
22 | 01 Apr 2014 @ 11:15 PDT | Database | Reply | PPI on Compression | Hi Praveen,
We can't use MVC(Multi Value Compression) Column in PPI.
Thanks & Regards,
Adharssh.
|
21 | 01 Apr 2014 @ 10:45 PDT | Database | Reply | Decimal and zeroes removal | Hi Nila,
The Above query will not result in error instead it will not give you the desired result without the zeros.
SEL CAST(TRANS_CNT as DECIMAL(18,0));
OR
SEL CAST(TRANS_CNT as INTEGER... |
20 | 17 Oct 2013 @ 06:00 PDT | Database | Reply | Adhoc request | Hi,
You can get these things,
sel * from dbc.DBQLSqlTbl where SQLTEXTINFO LIKE '%TABLENAME%' -- To get the Queries used against the Table
SEL * FROM DBC.TABLES WHERE TABLENAM... |
19 | 16 Oct 2013 @ 12:51 PDT | Database | Reply | Backup & Restore | Hi,
The Table structure will be stored in DBC.TABLES.
SELECT * FROM DBC.TABLES WHERE TABLENAME=<<TABLE_NAME>>;
Thanks & Regards,
Adharssh Hospet Srinivasa Rao.
|
18 | 16 Oct 2013 @ 12:47 PDT | Database | Reply | primary index in IN clause or exists clause >? | Hi,
"Exists' will be more efficient than "IN" Clause. Nulls will not be handled properly when we use the IN Clause.
Thanks & Regards,
Adharssh Hospet Srinivasa Rao.
|
17 | 15 Oct 2013 @ 04:20 PDT | Database | Reply | CREATE INSERT STATEMENTS FOR ALL THE TABLES IN A PARTICULAR DATABASE | Hi,
You can use the following DBC Table.
sel * from dbc.DBQLSqlTbl where sql_text_info like '%TABLE1%' ;
The following query will give out the SQL's performed for the TABLE1. It w... |
16 | 29 Sep 2013 @ 10:28 PDT | Database | Reply | Unable to figure out the error out of range input data | Hi,
You can change this line from
.field EmpNo 2 char(9);
to
.field EmpNo 2 VARCHAR(9);
This will work. If we specify, CHAR(9). It will try to check for 9 characters from the pos... |
15 | 14 Sep 2013 @ 02:04 PDT | Database | Reply | Update for Derive Tables | Hi,
Can You please let us know, What error did you faced? The Update Query is trying to Update the COLUMN 'COL55' but the SubQuery doesn't select the COL55.
Thanks &... |
14 | 13 Sep 2013 @ 12:44 PDT | Database | Reply | Bulk Loading | Hi,
The Following Code Snippet will work,
Assuming that your target table has 3 fields, COLUMNPI,COLUMN1,COLUMN2 and Source hastow fields COL1,COL2.
INSERT INTO TARGET_TABLE
(
COLUMNPI... |
13 | 13 Sep 2013 @ 05:49 PDT | Database | Reply | Find table size and last access date | Hi,
We have tablename & Databasename in both dbc.tables & dbc.tablesize. Please find the Code, that will give you the Tablename,Databasenaem,Creatorname,Lastaccesstimestamp & Currentpe... |
12 | 11 Sep 2013 @ 12:31 PDT | Database | Reply | Get Row Count of a Table on a previous date | Hi,
You can get the row count only when you have an Timsewtamp column,which will be updated when you insert or update the record in the table. So that we can get the row count using the Timestamp ... |