How can I change primary key of table???
GRUBBYFANS
Member Posts: 154
How can I change primary key of table??? Please tell me and give me an Example :-k :-k
0
Comments
-
if you want to change primary key of inbuilt table then i will suggest that don't do that [-X otherwise it will create so many problems.
object designer (sift +f12). open your table in table designer by clicking design button then go to view menu -> keys.
you will have list of keys. first row is a primary key of that table. other are secondary keys.
regards,Experience Makes Man Perfect....
Rajesh Patel0 -
Hi GRUBBYFANS,
On the other hand if you are asking how to change the data record of a primary key then use the rename function
e.g.IF Customer.GET( '10000' ) THEN BEGIN Customer.RENAME( 'new10000' );
Note the rename function changes the position in the file and you must send all the parts of the primary key.0 -
If you want to change primary key valuea of a table through then
"IF Customer.GET( '10000' ) THEN
BEGIN
Customer.RENAME( 'new10000' );"
Right option .
If u want to change field (which is primary key of the table ) then think the side effects .0 -
Thanks a lot !! I know How figure out problem0
-
This is My code ,hehe It is too long
Code:
"GRED_Sales Price".SETRANGE("Starting Date",080601D);
IF "GRED_Sales Price".FIND('-') THEN
REPEAT
IF "GRED_Sales Price".GET("GRED_Sales Price"."Item No.","GRED_Sales Price"."Sales Type","GRED_Sales Price"."Sales Code"
,"GRED_Sales Price"."Starting Date","GRED_Sales Price"."Currency Code","GRED_Sales Price"."Variant Code",
"GRED_Sales Price"."Unit of Measure Code","GRED_Sales Price"."Minimum Quantity") THEN
"GRED_Sales Price".RENAME("GRED_Sales Price"."Item No.",2,"GRED_Sales Price"."Sales Code",
"GRED_Sales Price"."Starting Date",'',"GRED_Sales Price"."Variant Code",'pc',"GRED_Sales Price"."Minimum Quantity");
UNTIL "GRED_Sales Price".NEXT=0;
Code0 -
Hi GRUBBYFANS,
Two observations of your code
1. why the get your already have the record with the find
2. You are using the same record variable in the rename which will reposition the record for the next.
The get should be to see if the new key exists i.e. UOM 'pc' and rename if not found.
Also use two new record variables to avoid repositioning0 -
DaveT wrote:Hi GRUBBYFANS,
Two observations of your code
1. why the get your already have the record with the find
2. You are using the same record variable in the rename which will reposition the record for the next.
The get should be to see if the new key exists i.e. UOM 'pc' and rename if not found.
Also use two new record variables to avoid repositioning
Thank you DaveT!! I found my code where is bug,you are very good!!0 -
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions