Professional Web Applications Themes

Renumber a field - Microsoft SQL / MS SQL Server

Does anyone have any examples of how I would go about renumbering a field, say the field starts with Alpha Numeric characters like AB and the number starts at 1000. If there are any good SQL tutorials or sites that would explain tthis that would be helpful also. Thanks In Advance and Happy 4th July to everyone. michae...

  1. #1

    Default Renumber a field

    Does anyone have any examples of how I would go about
    renumbering a field, say the field starts with Alpha Numeric
    characters like AB and the number starts at 1000.


    If there are any good SQL tutorials or sites that would
    explain tthis that would be helpful also.


    Thanks In Advance and Happy 4th July to everyone.



    michae
    michael Guest

  2. #2

    Default Re: Renumber a field

    not sure what is your exact requirement.
    Ex:
    drop table #t
    create table #t(orig_str varchar(500))

    insert into #t values('ab100')
    insert into #t values('ab101')
    insert into #t values('ab102')
    insert into #t values('ab103')
    insert into #t values('ab105')

    if you want above values to serially updated as ab101,ab102,ab103 , ab105
    and so on you can try following

    alter table #t add idd int not null identity(1,1)

    update #t set orig_str = 'ab' + cast(idd + 100 as varchar)

    select * from #t

    For correct solution pls post table structure some sample records and
    expected resultset.
    --
    -Vishal
    "michael" <ptbarnumnycap.rr.com> wrote in message
    news:uv7bgv0mk4qksjauulcr5k4ffpoaorhr6g4ax.com...
    > Does anyone have any examples of how I would go about
    > renumbering a field, say the field starts with Alpha Numeric
    > characters like AB and the number starts at 1000.
    >
    >
    > If there are any good SQL tutorials or sites that would
    > explain tthis that would be helpful also.
    >
    >
    > Thanks In Advance and Happy 4th July to everyone.
    >
    >
    >
    > michae

    Vishal Parkar Guest

Similar Threads

  1. I Desperately Need a Script for InDesign CS2 To Renumber Endnotes
    By Lydia_Del_Bianco@adobeforums.com in forum Adobe Indesign Macintosh
    Replies: 1
    Last Post: October 9th, 02:22 AM
  2. Defined text field in form -> subject field in e-mail
    By olaka in forum Dreamweaver AppDev
    Replies: 0
    Last Post: March 14th, 02:20 PM
  3. renumber index/key field?
    By Wm in forum PHP Development
    Replies: 1
    Last Post: August 9th, 07:51 AM
  4. renumber serial
    By Eric in forum FileMaker
    Replies: 1
    Last Post: June 27th, 12:11 AM

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