Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stored procedure for default value
Message
De
04/04/2000 05:04:37
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
04/04/2000 04:57:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00354863
Message ID:
00354866
Vues:
19
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform