Reputation: 83
I don't want to return the first three letters in the return values. An example:
select companyname from companies
-- returns companyX
Can I write a query that returns panyX instead?
Upvotes: 8
Views: 14198
Reputation: 197
you can solve your issue by using following queries,
--> select substring([image],4,len([image])) from dbo.emp
and
--> select replace([image],'ima','') from dbo.emp
Thanks
Venkat
Upvotes: 0
Reputation: 503
SELECT SUBSTRING(companyname, 3, len(companyname) - 2)
FROM companies
Upvotes: 0
Reputation: 33511
select right(companyname, len(companyname)-3) as companyname
will do the thing (this should work for microsoft T-SQ, see more string functions here )
Upvotes: 11
Reputation: 169304
Since you don't say what RDBMS you're using, here is an ANSI-compliant answer:
SELECT SUBSTRING(mycolumn,3,CHARACTER_LENGTH(mycolumn))
Upvotes: 4