MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert Into... Select

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Mon Sep 22, 2008 2:16 am    Post subject: Insert Into... Select Reply with quote

Is it possible to use INSERT INTO statement with SELECT for only some rows..like.. I want to insert only the first 100 rows from the select statement..

for ex. a statement like this
Code:
INSERT INTO <table name>
SELECT field1,
            field2,
            field3
   FROM table1
INSERT FIRST 100 ROWS ONLY

_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
danm
Intermediate


Joined: 29 Jun 2004
Posts: 170
Topics: 73

PostPosted: Mon Sep 22, 2008 8:17 am    Post subject: Reply with quote

Try:
INSERT INTO <table name>
SELECT field1,
field2,
field3
FROM table1
FETCH FIRST 100 ROWS ONLY
Back to top
View user's profile Send private message
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Tue Sep 23, 2008 1:16 am    Post subject: Reply with quote

Fetch first 100 rows only is only during select..this will not work..
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Sun Sep 28, 2008 1:47 pm    Post subject: Reply with quote

edkir98,

Isn't it supposed to be like declare cursor for first 100 records and then fetch and insert each individually?

Refrence - http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/sqlp/rbafycursorexamp.htm

Diba
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group