开发者

Skip first letters of all values returned from a sql server database

开发者 https://www.devze.com 2023-01-03 11:02 出处:网络
开发者_开发技巧as topic says, I don\'t want to return the first two letters in the return values

开发者_开发技巧as topic says, I don't want to return the first two letters in the return values just an example: select companyname from companies returns companyX

Can I write a query that returns panyX instead?

Thanks in advance


select right(companyname, len(companyname)-3) as companyname will do the thing (this should work for microsoft T-SQ, see more string functions here )


Since you don't say what RDBMS you're using, here is an ANSI-compliant answer:

SELECT SUBSTRING(mycolumn,3,CHARACTER_LENGTH(mycolumn))


SELECT SUBSTRING(companyname, 3, len(companyname) - 2) FROM companies


Here is a bunch of string manipulation stuff for sql

Tutorial 4: SQL functions


SELECT SUBSTR(COMPANYNAME,3) FROM COMPANIES;


u can solve ur issue using following queries,

 --> select substring([image],4,len([image]))from dbo.emp
 --> select replace([image],'ima','') from dbo.emp

Thanks

Venkat

0

精彩评论

暂无评论...
验证码 换一张
取 消