Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INSERT INTO command
Message
From
04/12/2000 10:07:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00448756
Message ID:
00448776
Views:
7
>IS it true when using insert into that you have to account for all the fields even thought you want to leave some of them blank? I have a dbf with 30 fields and want to insert a new record and I only care about say 5 fields, I have to provide a value for each 30?

No it's not true. You could provide just one if you want. But if you won't provide all values or you would provide values in a different order than its structure you have to specify fieldnames in the order you're providing values :

insert into myTable (myField3, myField7) values ('FieldValue',{^2000/1/1})

First parentheses part (parentheses required) is a list of fields in the order you provide values.
Second parentheses (after values-again parentheses required) lists values that would go to fields in corresponding order in first.
Note: Fields that have a default value defined get that defined value unless overridden by providing a value for them.

You could also do this :

scatter memvar blank
m.MyField8 = 'Somevalue' && Only populate field named MyField8
insert into myTable from Memvar

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