Skip to Content
author's profile photo Former Member
Former Member

How to chnage datatype of Code field of master data


I want to change Code field varchar datatype to int it possible through query,,?????

I tried with following query...showing error like .This key is acessed by other keys


Actually my requirement is i want to generate serial no for code field but it is type of varchar due to this reason ...

records not getting inserted into proper position.(suppose i inserted 9 records. 10 record should insert at last but due to this varchar 10 record is inserting 2nd position this is making problem while pressing last rec,firstrec elc...)

im not at all getting last record properly........

is der any alternative.............????///



Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2009 at 06:01 AM

    Hi Firoz,

    This is a common problem. Alter table isn't a solution for this. For this the way i handle it is, since being a master table, you will be having code and doc entry which is mandatory. To maintain a sequence one you can have the sequence column as regular 1,2,3... and for the other column, you can actually have the below line for reference.

    oForm.DataSources.DBDataSources.Item("@MY_Table").SetValue("DocEntry", 0, strValue.PadLeft(8, '0'));

    That is, if you see, the DocEntry is padded left with 0's till 8 posn.

    Hope this helps.


    Satish. B.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello Pariminhas..

      thx 4 ur rpy

      i have a header table with one child table . Now im insrting my records using UDO.
      suppose i inserted 10 records into database...all these records are sorting based on code field
      i dont want to sort the inserted records . i want my records  inserted order then only navigation keys work fine..?



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.