Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select from 6 characters until the end... 1

Status
Not open for further replies.

hokky

Technical User
Nov 9, 2006
170
AU
Hi guys,

As title above, I need to select from 6th character until the end, how do I do that ?

for example :
Code:
input               output

albertman           man
happyforever        orever

thanks guys
 
substring(string,7,8000)

I wonder if this method is any faster or slower...

rudy caught the 6/7 discrepancy too...
 
substring(string,7,8000) will not work if it's a VARCHAR(MAX) column which has a value longer than 8006 bytes

;-)

r937.com | rudy.ca
 
yes one would have to be careful with that

substring(string,7, 2147483647)
 
That works, too.

Still wondering about the comparative speed of the substring method I suggested. :)
 
you don't have to specify the end.

?substr(alltrim(lcString),7)


Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
ali, which dbms are you using?

in Microsoft SQL Server, there is no "alltrim" function, and substr requires 3 arguments

r937.com | rudy.ca
 
I'm going to hazard a guess at FoxPro?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top