Discussion:
Is there any issue with autoincremented field?
(too old to reply)
Peter
2005-03-22 03:57:02 UTC
Permalink
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.
Peter
2005-03-22 04:13:02 UTC
Permalink
Sorry, the SQL Server table is Identity column not uniqueidentifier column.

Peter
Post by Peter
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-03-22 05:34:28 UTC
Permalink
Post by Peter
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
-----------------------------------------------------------
Peter
2005-03-22 19:31:14 UTC
Permalink
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
Post by Stefan Wuebbe
Post by Peter
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-03-24 04:46:50 UTC
Permalink
Post by Peter
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
Post by Peter
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
-----------------------------------------------------------
Lee Mitchell
2005-03-22 20:51:18 UTC
Permalink
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/info/product.aspx?view=22&pcid=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
Post by Peter
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
-----------------------------------------------------------
Loading...