|
Home > Archive > FoxPro database connector > April 2005 > Is there any issue with autoincremented field?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Is there any issue with autoincremented field?
|
|
|
| I'm trying to convert a SQL Server table which has uniqueidentifier column
into a VFP 9 table. I wonder whether I should use autoincremented field or
write a routine to increment the integer.
Thansk for any help.
| |
|
| Sorry, the SQL Server table is Identity column not uniqueidentifier column.
Peter
"Peter" wrote:
> I'm trying to convert a SQL Server table which has uniqueidentifier column
> into a VFP 9 table. I wonder whether I should use autoincremented field or
> write a routine to increment the integer.
>
> Thansk for any help.
| |
| Stefan Wuebbe 2005-04-07, 8:05 pm |
|
"Peter" <Peter@discussions.microsoft.com> schrieb im Newsbeitrag
news:4006143E-03B7-4DCA-858D- C841074D276E@microso
ft.com...
> I'm trying to convert a SQL Server table which has uniqueidentifier column
> into a VFP 9 table. I wonder whether I should use autoincremented field or
> write a routine to increment the integer.
Actually there are disadvantages, IMO - personally I still prefer
the older "newID"/default value approach.
GETAUTOINCVALUE() was introduced in Vfp9, so there was
no easy way to get the last value in Vfp7 and Vfp8.
It is still impossible to retrieve a value in advance, for example
when you want to Insert a parent row together with several child
rows at the same time w/o committing the parent row in advance
while data are buffered or in a transaction.
Backwards compatibility might be an issue.
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
| |
|
| Hi Stefan,
I have the same problem about not knowing the next insert value since
another column in the same table will contain a value which is concatenated
with that value. So, I always need to replace that column after the record
is inserted.
I just read the help on GETAUTOINCVALUE(). It seems this function only
returns value if the inserting is happened in one of the data sessions.
Before reading the help, I thought this function will accept a parameter for
a tablename and it will return the last value inserted to that table. If the
help is correct and I have multiple tables having autoinc field and used them
in the same data session, it will mean I need to have variables to hold the
returned value of this function for each table.
Regarding the newid/default you mentioned, are you referreing to the Create
a Default Unique ID Value for a Field Sample in VFP 8?
Thanks
"Stefan Wuebbe" wrote:
>
> "Peter" <Peter@discussions.microsoft.com> schrieb im Newsbeitrag
> news:4006143E-03B7-4DCA-858D- C841074D276E@microso
ft.com...
>
> Actually there are disadvantages, IMO - personally I still prefer
> the older "newID"/default value approach.
> GETAUTOINCVALUE() was introduced in Vfp9, so there was
> no easy way to get the last value in Vfp7 and Vfp8.
> It is still impossible to retrieve a value in advance, for example
> when you want to Insert a parent row together with several child
> rows at the same time w/o committing the parent row in advance
> while data are buffered or in a transaction.
> Backwards compatibility might be an issue.
>
>
> hth
> -Stefan
>
>
> --
> |\_/| ------ ProLib - programmers liberty -----------------
> (.. ) Our MVPs and MCPs make the Fox run....
> - / See us at www.prolib.de or www.AFPages.de
> -----------------------------------------------------------
>
>
| |
| Lee Mitchell 2005-04-07, 8:05 pm |
| Hi Peter:
I would like to mention a possible issue with backward compatibility. If
you decide to use the autoincrement field type, you are not going to be
able to access the table using the VFP ODBC driver. You need to use the
VFP OLE DB Provider. This is not a real issue unless you plan on accessing
the table from an application other than VFP 8.0 or later.
I hope this helps.
This posting is provided "AS IS" with no warranties, and confers no rights.
Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell
*-- VFP9 HAS ARRIVED!! --*
Read about all the new features of VFP9 here:
http://msdn.microsoft.com/vfoxpro/
Purchase VFP8 here:
http://www.microsoft.com/PRODUCTS/i...cid=54787e64-52
69-4500-8bf2-3f06689f4ab3&type=ovr
Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003
>"Peter" <Peter@discussions.microsoft.com> schrieb im Newsbeitrag
>news:4006143E-03B7-4DCA-858D- C841074D276E@microso
ft.com...
> I'm trying to convert a SQL Server table which has uniqueidentifier column
> into a VFP 9 table. I wonder whether I should use autoincremented field
or
> write a routine to increment the integer.
>Actually there are disadvantages, IMO - personally I still prefer
>the older "newID"/default value approach.
>GETAUTOINCVALUE() was introduced in Vfp9, so there was
>no easy way to get the last value in Vfp7 and Vfp8.
>It is still impossible to retrieve a value in advance, for example
>when you want to Insert a parent row together with several child
>rows at the same time w/o committing the parent row in advance
>while data are buffered or in a transaction.
>Backwards compatibility might be an issue.
>hth
>-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
| |
| Stefan Wuebbe 2005-04-07, 8:05 pm |
| > Regarding the newid/default you mentioned, are you referreing to the Create
> a Default Unique ID Value for a Field Sample in VFP 8?
Yes, that's one (available in the TaskPane based on the newid.* files
in the examples folder, right?). Another one is on Craig's web site oc
http://craigberntson.com/Articles/kb006.htm
> I just read the help on GETAUTOINCVALUE(). It seems this function only
> returns value if the inserting is happened in one of the data sessions.
> Before reading the help, I thought this function will accept a parameter for
> a tablename and it will return the last value inserted to that table. If the
> help is correct and I have multiple tables having autoinc field and used them
> in the same data session, it will mean I need to have variables to hold the
> returned value of this function for each table.
Yes, I think you're right.
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
|
|
|
|
|