The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Creating a dynamic case statement squrcles Shell Programming and Scripting 5 12-19-2008 09:48 AM
error in insert statement ragavhere Shell Programming and Scripting 2 12-08-2008 03:44 AM
How is use sselect statement o/p in insert statement. nkosaraju Shell Programming and Scripting 2 08-06-2008 09:26 PM
Insert TAB in echo statement sunils27 Shell Programming and Scripting 5 08-26-2005 03:36 AM
awk command for INSERT statement nattynatty Shell Programming and Scripting 4 05-10-2002 02:11 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-02-2009
pritish.sas pritish.sas is offline
Registered User
  
 

Join Date: Dec 2008
Location: Mumbai
Posts: 44
Dynamic Insert statement

I have a form , where i will put the values to a table.

I wrote a insert statement for the same.
Table structure is
ename | character varying(30) |
eadd | character varying(30) |
eid | integer |
sal | integer



In the statements, i don't want to write all the column names and values. i mean
INSERT INTO emp (ename,eadd, eid,sal) VALUES (?,?,?,?);
i gave something in the last column i.e sal, then my sql statement should look like.

INSERT INTO emp (sal) values(that given in the form);

The Code should be dynamic. If we will fill 3 fields in the form then code should be
INSERT INTO tablename(col1,col2,col3) VALUES (val1,val2,val3);
  #2 (permalink)  
Old 07-30-2009
figaro figaro is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 267
Assuming these values are coming from a web form, you can refer to the fields via the name attribute or id attribute of the fields they refer to? In other words, a solution to your issue is only possible if there is a mapping between the semantics of your input data and the structure of your table.
Sponsored Links
Reply

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0