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

How to chnage datatype of Code field of master data

Hello,All

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

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

ALTER TABLE [@VEDA_ALMD] ALTER COLUMN Code int 

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.............????///

by

Firos

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.

    Regards,

    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..?
      
      

      by

      Firos

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.