Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INSERT SQL VALUES VARYING
Message
From
24/10/2001 20:53:38
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00572866
Message ID:
00572979
Views:
35
Very wild as I commented at the end of the post, because there is a number of ways that this could fail. I was just throwing it out to illustrate that it is possible with a multiple-row insert.

I would probably use a temporary table to get the desired results.

>Very dangerous however....
>
>If the structure ever changes, the Insert Statement has a good possibility of failing.
>
>But...it will get the job done..
>
>
>>>Hi folks - just wondered if anyone knew of an equivalent MS SQL command to this RDB SQL command...
>>>
>>>INSERT INTO table (field1, field2, field3) VALUES (fixed, fixed, var1) VARYING (var1 [1-52])
>>>
>>>This makes one statement do 52 inserts...
>>>
>>>Any ideas?
>>
>>Not exactly, but you can do a multiple row insert by specifying a select statement instead of the VALUES(). Combining this with an existing table, an identity column and the TOP clause you can get close to the same effect:
>>
Insert Into table
>>   Select Top 52 'something1' as fixed, 'something2' as fixed2
>>   From myExistingTable
>>The existing table would need to have the number of rows specified after the TOP clause, and the target table would need to have the identity field defined (var1 in your example). Unfortunately you would not control the sequence on the identity field by going this way unless you clear the table of rows first with TRUNCATE TABLE.
>>
>>Just a wild idea.
Previous
Reply
Map
View

Click here to load this message in the networking platform