Hi all, i am trying to insert just one field into a table which contains many fields. When i am executing this i am getting an error that the "destinational fields are not the same as the query results" If anyone can tell me how i can insert just one field in a table of many fields. Thank you and regards vikram
Hi, generally you can't just insert a single column into a table (unless the row only has one column), you have insert an entire row. You might have to populate the other columns with dummy data (depending on their data type). Updates can be done on single columns though. James.
INSERT INTO table (field) SELECT field FROM othertable WHERE ... This will only work if the other fields in the table are either NULL fields or have default values. In particular, the primary key field(s) (if any) need to be populated in some way unless they are autogenerated (SQL Server identity field, Oracle sequence in a trigger, PostgreSQL serial...) - Peter
Actually in this case number of records u r going to insert doesn't match with no.of columns.. To avoid this u need to specify the column names where u want to insert values.. like: INSERT INTO TABLE(FIELDS) VALUES("..) Hope this will solve ur prob.. Thanks Pranit..
Originally posted by vikram nalagampalli: "destinational fields are not the same as the query results"
posted 18 years ago
Thanks one and all for your replies.
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?