Tags: character, prodname, product, programming, query, row, select, sql

Replace the First Character

On Programmer » SQL

784 words with 2 Comments; publish: Thu, 29 May 2008 02:09:00 GMT; (20046.88, « »)

Hi All,

My query is

Select ID, ProdName from Product

I would like to replace the first character from ProdName (in every row)

with *.

Please let me know how to do it.

Thanks.

All Comments

Leave a comment...

  • 2 Comments
    • SELECT ID, '*'+SUBSTRING(ProdName,2,8000) as ProdName FROM Product

      Razvan

      #1; Thu, 29 May 2008 02:10:00 GMT
    • On Sun, 18 Sep 2005 02:22:26 -0700, msnews wrote:

      >Hi All,

      >My query is

      >Select ID, ProdName from Product

      >I would like to replace the first character from ProdName (in every row)

      >with *.

      >Please let me know how to do it.

      >Thanks.

      >

      Hi msnews,

      Here's another way:

      SELECT ID, STUFF(ProdName, 1, 1, '*') FROM Product

      Best, Hugo

      --

      (Remove _NO_ and _SPAM_ to get my e-mail address)

      #2; Thu, 29 May 2008 02:11:00 GMT