To insert a value with ('') without concatenating them(+)

  •  

    All,

     There is a requirement where i need to insert a value say (Microsoft's).

    This should not be achieved with concatenating (+) but with someother method. please let me know if there is any query to achieve this.

    Any code apart from the below.

    select 'Microsoft' + '''' + 's'

     

     

    With regards,

    Sudarsan S

  • Hi Sudarsan,

    I'm not really sure what your situation is for wanting to do this. Knowing a little more may help in find the best solution for you.

    In the mean time here is a way:

    SELECT STUFF('Microsoft',LEN('Microsoft'),LEN('''s')+1,RIGHT('Microsoft',1)+ '''s')

    hope this helps

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • Maybe I'm misunderstanding your requirement, but...

    SELECT

    'Microsoft''s'

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply