substr vs substring

Database
Enthusiast

substr vs substring

hi

have few questions reg substr & substring

a. which one is ANSI compliant?

b. whats th difference btween two?

c. which one should be used?

Natasha

4 REPLIES
Teradata Employee

Re: substr vs substring

a. SUBSTRING(<text> FROM <start of characters> FOR <count of characters> is ANSI standard

b. Both can be used, they generate same output

c. Anyone can be used .... if you are connected via ODBC you can use all three options

HTH!

Enthusiast

Re: substr vs substring

3 options??? is there a third? whats that?

Teradata Employee

Re: substr vs substring

1. SUBSTRING (Text FROM 1 FOR 10)

2. SUBSTR(Text, 1, 10)

3. SUBSTRING(Text, 1, 10)

2 is Teradata extension, 3 is ODBC styled function and 1 is ANSI standard.

HTH!

Enthusiast

Re: substr vs substring

thanks. :)