Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append from Array with default value(primary key)
Message
From
09/10/2003 13:14:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
09/10/2003 13:03:33
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00837014
Message ID:
00837020
Views:
32
This message has been marked as a message which has helped to the initial question of the thread.
>I have a table with a primary key index. The default value for the field is a newid() function. I have a local view of the table, and want to append to the view from an array, and I can't get it to work.
>
>If I include the primary key in the array, I get a uniqueness of primary key violation. If I don't include it, I don't get a primary key. I can't get the primary keys before filling the array because it's a SELECT into array.
>
>Can someone help me fix this Catch 22?
>
>Chris.

Chris,
There are multiple ways to workaround. I think array processing is well fast and efficient :
select 0x7FFFFFFF as Pkfield, ... into ... array aRecs
for ix=1 to alen(aRecs,1)
  aRecs[ix,1] = NewID('myTable')
endfor
select myTable
append from array aRecs
PS: You might even make NewID() call part of SQL.
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