All Forums Database
natali 16 posts Joined 02/14
18 Feb 2014
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

Natasha
Adeel Chaudhry 773 posts Joined 04/08
18 Feb 2014

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!
 

-- If you are stuck at something .... consider it an opportunity to think anew.

natali 16 posts Joined 02/14
18 Feb 2014

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

Natasha

Adeel Chaudhry 773 posts Joined 04/08
18 Feb 2014

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!

-- If you are stuck at something .... consider it an opportunity to think anew.

natali 16 posts Joined 02/14
18 Feb 2014

thanks. :)

Natasha

You must sign in to leave a comment.