access_time 7y languageEnglish
more_vert

Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement

visibility 47,157 comment 7
SELECT is one of the most commonly used statements. In this tutorial, I will cover the following items: Two of the principal query clauses—FROM and SELECT Data Types Built-in functions CASE expressions and variations like ISNULL and COALESCE. * The function names mentioned above are ...
info Last modified by Administrator 2y
thumb_up 2

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

comment Comments
5y link more_vert
account_circle Raymond
#162 Re: Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement

@Mahe I could not identify any issue with your query directly.

Is your connection using the same credential as you were using in SQL Assistant?

format_quote

person Mahe access_time 5y
Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement

Hello, I am having trouble using JPA to run Teradata queries. I am able to run the generated query in SQL Assistant but not from JPA. Below is the exception. com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=UY_DEV_DATA.EQ_EV_H, DRIVER=3.62.56 select equipevent0_.EQ_IN as EQ_INIT_1_13_, equipevent0_.EV_DT as EVENT_DT2_13_, equipevent0_.EV_TM as EVENT_TM3_13_, equipevent0_.EV_TYPE as EVENT_TY4_13_, equipevent0_.WB_N as WB_SN5_13_, equipevent0_.CI_NA_19 as CITY_NAM6_13_, equipevent0_.LO_EY as LOAD_EMP7_13_, equipevent0_.R_BL_TM_RD as RPT_BLK_8_13_, equipevent0_.SP as SPLC9_13_, equipevent0_.ST_PR_IN as STATE_P10_13_, equipevent0_.TR_B_N as TRANS_W11_13_ from UY_DEV_DATA.EQ_EV_H equipevent0_ where equipevent0_.EQ_IN = 'ABCD123456' and equipevent0_.WB_N = '654654' The query runs successfully in SQL Assist and the schema.table is valid too. Can you please help ? Thanks, Mahe
6y link more_vert
account_circle Raymond
#161 Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement
@Eduardo Silva I am not sure whether I understand it correctly. There is non RIGHT function, so you have to use SUBSTR, for example, substr('nombre_columna', CHARACTER_LENGTH(nombre_columna)-2,3)
format_quote

person Eduardo Silva access_time 6y
Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement

Buenas tardes. En SQL utilizo el rigjht('nombre_columna',3) para rescatar una cierta cantidad de caracteres de una columna. Que sentencia deberia usar en TERADATA?
6y link more_vert
account_circle Raymond
#160 Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement
@Martin Thanks for the correction Martin. The right query should be: SELECT Emp.EmployeeID, Emp.EmployeeName, LEN(EmployeeName) AS EmployeeNameLength, SUBSTRING(EmployeeName FROM 1 FOR 1) AS EmployeeNameInitials, CAST((Emp.JobGrade (FORMAT '9')) AS VARCHAR(1)) || ' - ' || CAST((Emp.Salary (FORMAT '9(3),999.99')) AS VARCHAR(13)) AS EmployeeJobGradeAndSalary FROM Employee Emp;
format_quote

person Martin access_time 6y
Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement

In part Character function, the second teradata query is wrong. UBSTRING(EmployeeName FROM 1 FOR 1) AS EmployeeNameLength, will give you in EmployeeNameLength column employee initials, the same like in EmployeeNameInitials
6y link more_vert
account_circle Eduardo Silva
#97 Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement
Buenas tardes. En SQL utilizo el rigjht('nombre_columna',3) para rescatar una cierta cantidad de caracteres de una columna. Que sentencia deberia usar en TERADATA?
6y link more_vert
account_circle Martin
#96 Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement
In part Character function, the second teradata query is wrong. UBSTRING(EmployeeName FROM 1 FOR 1) AS EmployeeNameLength, will give you in EmployeeNameLength column employee initials, the same like in EmployeeNameInitials
5y link more_vert
account_circle Mahe
#95 Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement
The alignment is all messed up in the comments. Sorry about that. BTW, its a VIEW select and not a TABLE
5y link more_vert
account_circle Mahe
#94 Re:Querying Teradata and SQL Server - Tutorial 1: The SELECT Statement
Hello, I am having trouble using JPA to run Teradata queries. I am able to run the generated query in SQL Assistant but not from JPA. Below is the exception. com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=UY_DEV_DATA.EQ_EV_H, DRIVER=3.62.56 select equipevent0_.EQ_IN as EQ_INIT_1_13_, equipevent0_.EV_DT as EVENT_DT2_13_, equipevent0_.EV_TM as EVENT_TM3_13_, equipevent0_.EV_TYPE as EVENT_TY4_13_, equipevent0_.WB_N as WB_SN5_13_, equipevent0_.CI_NA_19 as CITY_NAM6_13_, equipevent0_.LO_EY as LOAD_EMP7_13_, equipevent0_.R_BL_TM_RD as RPT_BLK_8_13_, equipevent0_.SP as SPLC9_13_, equipevent0_.ST_PR_IN as STATE_P10_13_, equipevent0_.TR_B_N as TRANS_W11_13_ from UY_DEV_DATA.EQ_EV_H equipevent0_ where equipevent0_.EQ_IN = 'ABCD123456' and equipevent0_.WB_N = '654654' The query runs successfully in SQL Assist and the schema.table is valid too. Can you please help ? Thanks, Mahe
timeline Stats
Page index 19.28