Left Function || Conversion of Sql Server to Teradata

Database
Enthusiast

Left Function || Conversion of Sql Server to Teradata

Hello everyone,

Sorry. I'm disturbing your. I have a question about conversion of SQL Server Query to Teradata Query about LEFT function.

 If anyone can help me in conversion of query to teradata;

select 

CASE WHEN ( LEFT (COLUMNNAME,2) <> 60 AND COLUMNNAME2 IN (1,2)) THEN 2 ELSE 1 END )

FROM TABLENAME

I tried with Substring function. But I give syntax error.

By the way, Column Data Type: varchar(5)

Thanks in advance.

Ismail

2 REPLIES
Junior Supporter

Re: Left Function || Conversion of Sql Server to Teradata

You don't give DDL's, your attempts and the errors you get, but

SELECT

   CASE

      WHEN (SUBSTR(COLUMNNAME,1,2) <> '60' AND COLUMNNAME2 IN (1,2))

         THEN 2

      ELSE 1 END

FROM TABLENAME

should work.

Cheers.

Carlos.

Enthusiast

Re: Left Function || Conversion of Sql Server to Teradata

Thank you for update Carlos,

it's working.

Thanks.

Ismail