I currently have the following code in SQL server:
IF OBJECT_ID (N'PRJ_QA.dbo.TEST', N'U') IS NOT NULL
SELECT COUNT(*) AS [ OLD_COLON_VALID ] FROM
I'm curious what the Teradata equivalent to this code would be.
One way to do it in a stored procedure:
Declare Exists int;
select count(*) from DBC.TABLESV where DatabaseName = 'PRJ_QA' and TableName = 'dbo_TEST' into :Exists;
If :Exists > 0
SELECT COUNT(*) AS OLD_COLON_VALID FROM PRJ_QA.dbo_TEST;
Note that there is only one high-level qualifier of a table name in Teradata, so I changed the table name from dbo.TEST to dbo_TEST.