MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 11th, 2003, 09:35 AM
BanksySan's Avatar
BanksySan BanksySan is offline
A mule with a spinning wheel.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Wales
Posts: 113 BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 48 m 39 sec
Reputation Power: 7
MySpace
Cool Bulk insert VB to Access

Hi,

I need to write a SQL statment to insert data into a table. Not a problem. But, can I insert more than one row/record at a time?

e.g. If I have a 'Person' table with 'First_Name' and 'Last_Name' fields and 50 peeps to put in them all in the same statment, or do I have to keep reusing the query 50 times??

Thanks

Dave

Reply With Quote
  #2  
Old October 12th, 2003, 09:06 AM
BanksySan's Avatar
BanksySan BanksySan is offline
A mule with a spinning wheel.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Wales
Posts: 113 BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level)BanksySan User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 48 m 39 sec
Reputation Power: 7
MySpace
Arrow For Example

For example, to insert 1 new record into my Person table I could use:

INSERT INTO Person(First_Name,Last_Name)
VALUES("Joe","Bloggs")


Could I write a single SQL statement which would put more than 1 record in?

Cheers

Reply With Quote
  #3  
Old September 15th, 2004, 05:18 PM
BugMeNot BugMeNot is offline
Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 42 BugMeNot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 39 sec
Reputation Power: 0
Quote:
Originally Posted by BanksySan
For example, to insert 1 new record into my Person table I could use:

INSERT INTO Person(First_Name,Last_Name)
VALUES("Joe","Bloggs")


Could I write a single SQL statement which would put more than 1 record in?

Cheers



try :INSERT INTO Person(First_Name,Last_Name)
VALUES("Joe","Bloggs"), ("Mary","Jane"), ("Peter","Parker")

...and so on!
Never tried it in MS sql server but it works in mysql

LcabraL was here

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Bulk insert VB to Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway