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 

SQL INSERT

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


Joined: 18 Jan 2003
Posts: 12
Topics: 7

PostPosted: Tue Apr 22, 2003 9:40 am    Post subject: SQL INSERT Reply with quote

Hi,

How Can I insert into a table values for some columns from one table and
rest with values option ?

This query is not a working one. I want to know if there is any other way.

INSERT INTO ENGR_WO_APPROVER

(APPROVER, EMP_LAST_NAME, EMP_FIRST_NAME,
UPDATE_CLOCK_NO, UPDATE_PROGRAM, UPDATE_TIMESTAMP)

SELECT EMPLOYEE_NUMBER, EMP_LAST_NAME, EMP_FIRST_NAME
FROM TXDBT01.LDAP_DIRECTORY WHERE EMPLOYEE_NUMBER = 'zzzzzzzz'

and

VALUES ('OUTX625','CEDSF01C',CURRENT TIMESTAMP)


Thanks,
Ram. Question
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Tue Apr 22, 2003 10:13 am    Post subject: Reply with quote

Try this

INSERT INTO ENGR_WO_APPROVER

(APPROVER, EMP_LAST_NAME, EMP_FIRST_NAME,
UPDATE_CLOCK_NO, UPDATE_PROGRAM, UPDATE_TIMESTAMP)

(SELECT EMPLOYEE_NUMBER, EMP_LAST_NAME, EMP_FIRST_NAME,'OUTX625','CEDSF01C',CURRENT TIMESTAMP
FROM TXDBT01.LDAP_DIRECTORY WHERE EMPLOYEE_NUMBER = 'zzzzzzzz' )
Back to top
View user's profile Send private message
YVRAMJ
Beginner


Joined: 18 Jan 2003
Posts: 12
Topics: 7

PostPosted: Tue Apr 22, 2003 10:44 am    Post subject: Reply with quote

Hi,

I am sorry. I forgot to mention about the query. I am storing this query in a DB2 table so that my stored procedure can read it and prepares and then executes. In this process I will be passing the last 3 columns as parameters. So I can't code them as constats except current timestamp.
sorry for the confusion.

Thanks,
Ram.
Back to top
View user's profile Send private message
YVRAMJ
Beginner


Joined: 18 Jan 2003
Posts: 12
Topics: 7

PostPosted: Tue Apr 22, 2003 11:43 am    Post subject: Reply with quote

Hi,

I got the solution. I passed the variables as parameters and it worked fine.

Thanks,
Ram.
Back to top
View user's profile Send private message
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