Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored procedure for default value
Message
From
04/04/2000 05:04:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/04/2000 04:57:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00354863
Message ID:
00354866
Views:
13
>I need help on following:
>
>I have a VFP native database and a table say 'mytable.dbf'. The primary key in mytable is 'pkfield' and of character type. The value for this primary field is to have something like 'YYYY?????' where YYYY should be replaced with the year the user will type and the ????? should be a number automatically calculated.
>
>For example, If I have 10000 records in that table of which 7500 are for the year 1999 and 2500 are for the year 2000. What I need is to have the primary field to have the default value as "199907501" when the user enters the year as 1999 and fill up additional values and save. Same way, it should be "200002501" if the user entered the year as 2000.
>
>I could use the stored procedure for to calculate the next number automatically but my problem is to get the last number for a specific year. Can anyone, please help me in this?
>
>Thanks in advance.


Unless what you want need not be sequential you cannot do it in a multiuser environment with buffered tables. If it's OK to use nonsequential values then create a table to keep track of last given number and increment it in your routine. Check tastrade.app for a sample.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform