Professional Web Applications Themes

Add Quote : Sql Server 2000 - Microsoft SQL / MS SQL Server

Venugopal Vemuri wrote:  Are X and H in different columns? Or do you have one column containing X,H?...

  1. #1

    Default Re: Add Quote : Sql Server 2000

    Venugopal Vemuri wrote: 
    Are X and H in different columns? Or do you have one column containing X,H?


    Bob Guest

  2. #2

    Default Re: Add Quote : Sql Server 2000

    double up the single quote.
    Ex:
    select '''X''','''H'''

    --
    -Vishal

    "Venugopal Vemuri" <com> wrote in message
    news:094a01c34f94$a73bbcd0$gbl... 


    Vishal Guest

  3. #3

    Default Re: Add Quote : Sql Server 2000

    Are you looking for something like this?

    create table test
    (id int identity(1,1) not null primary key
    , value char(30)
    )

    insert into test (value)
    select 'X,K'
    union
    select 'F,G,Z'
    union
    select 'H'
    union
    select null

    select
    '''' + replace(value, ',',''',''') + ''''
    from test

    drop table test

    --
    Dean Savovic
    www.teched.hr


    "Venugopal Vemuri" <com> wrote in message news:094a01c34f94$a73bbcd0$gbl... 


    Dean Guest

  4. #4

    Default Re: Add Quote : Sql Server 2000

    Hi Dinesh,
    Each row in the table would be containing value
    H,X,M,N,P..... The requirement is a select statement that
    would give the output as 'H','X','M','N','P'. Please let
    me know for further queries/clarifications.
    Regards,
    Venugopal [/ref]
    one [/ref]
    requirement [/ref]
    should 
    >> column containing X,H? [/ref]
    >
    >
    >.
    >[/ref]
    Venugopal Guest

  5. #5

    Default Re: Add Quote : Sql Server 2000

    Try:
    create table quote(val varchar(500))
    insert into quote select 'H,X,M,N,P'

    select '''' + replace (val, ',',''',''') + '''' from quote

    --
    -Vishal

    "Venugopal Vemuri" <com> wrote in message
    news:095201c34fa0$01b50cb0$gbl... [/ref]
    > one [/ref]
    > requirement [/ref]
    > should 
    > >
    > >
    > >.
    > >[/ref][/ref]


    Vishal Guest

  6. #6

    Default Re: Add Quote : Sql Server 2000

    Hi Vishal,
    Thanks that works.
    Regards,
    Venugopal 
    quote [/ref]
    that [/ref]
    let [/ref][/ref]
    message [/ref][/ref]
    have 
    >> requirement 
    >> should [/ref]
    >
    >
    >.
    >[/ref]
    Venugopal Guest

Similar Threads

  1. Access 2000 or SQL Server 2000
    By Denis in forum ASP Database
    Replies: 1
    Last Post: January 25th, 03:38 PM
  2. Replies: 5
    Last Post: December 6th, 12:55 PM
  3. Replies: 1
    Last Post: September 5th, 08:55 PM
  4. Replies: 0
    Last Post: September 5th, 01:50 PM
  5. Single quote (') problem in SQL Server query
    By Ben in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 14th, 09:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139