Using SQL to extract an attachment from another table (Access 2010)? - sql

Well basically I have two tables with a field which is the same in both table (As in the fields are both set to an attachment). Now somehow I would like to extract all the field from one table to another. When I try the following syntax the following error message occurs.
INSERT INTO Student (Photo)
SELECT Photo FROM Students_Record1;
ERROR MESSAGE : An Insert INTO query cannot contain multi-valued field.
From this error message I noticed that this got to do with the datatype as it was set to an attachment.
So I did the following code
INSERT INTO Student (Photo,Photo.FileData,Photo.FileName,Photo.FileType)
SELECT Photo,Photo.FileData,Photo.FileName,Photo.FileType FROM Students_Record1;
Which also outputs the same error as the above.
ERROR MESSAGE : An Insert INTO query cannot contain multi-valued field.
Anyone knows how can I extract an attachment from one table to another using SQL ?
Thank you!

Try to delete the first field.
Would be
INSERT INTO Student (Photo.FileData,Photo.FileName,Photo.FileType)
SELECT Photo.FileData,Photo.FileName,Photo.FileType FROM Students_Record1;

Related

while inserting the values i am getting "invalid number" error

sq
in image you can see that i am getting error "invalid number".
how can i fix this error.
you should check your data types for every column where you want to insert data. For example I see that you try to add data with "$9,99" which seems a little bit strange. May have a look again.
Maybe there is a column of orders which expects a number and you're trying to insert an non-number.
You could double-check the table definition in SQL Developer or by using DESC <table>.

Error when trying to use custom datatype in SQL Developer

I am trying to create a table where two columns have custom data types that I created. When I select the datatype from my schema and try to save the table, I get the following error. Any suggestions?

MS Access Syntax Error: When I select the ID in the list table it gives a syntax error with the ID=

I am pulling in salesforce tables from a sql server db and the picture below shows how the data types were set. I am using the customer template and the list and detail screens work with the sample tables. However, when I change the table to dbo.case which I have converted to an internal table along with the user table which is used for employees I get the error below. I am trying to figure out why the error happens and I have only changed the tables and made the appropriate changes to map the fields in the form to the new table.
error message: Syntax Error (missing operator) in query expression '[ID]=5001...'.
Macro single step
Table setup
A string value must be wrapped in quotes:
[ID]='5001a00000a0FcRAAU'

Access97: INSERT INTO fails without a table or a query

I need to execute a simple INSERT INTO query on an old Access97 database.
I'm starting with a very short example - which doesn't work:
INSERT INTO [MY-TABLE]( [Field1] )
VALUES ( "blabla" )
MY-TABLE is the actual name of the table and Field1 is a String field.
I get the error:
Query input must contain at least one table or query
Because I need to insert literal value, I don't want to use a query here (i.e. a SELECT FROM)
Reading also the docs (https://msdn.microsoft.com/en-us/library/bb208861(v=office.12).aspx) I don't see where my SQL is wrong.
UPDATE
Here a couple of screen shot of the actual table and fields:
here the SQL code:
Anyway...
SOLVED!!
It works even with double quotes.
The problem was the push button I was using to check: using the "View" button leads to the error above. Instead I must use the "exclamation mark".
I need to execute the query using the "exlamation mark" button instead of the view one. This is because my query has not a result set to view - hence the error I saw.
By the way I confirm the syntax is accepted both with single or double quotes.

Dash in a field name in access database table

Im having problems retrieving a field from my ms-access database.
The table name is TEST and one of the field's name is HD-TEST
When i do:
SELECT * from TEST where TEST.HD-TEST='H' and i execute the query, ms-access shows me a dialog expecting the parameter HD.
Do you know what could be the reason?
Thanks a lot.
Kind Regards.
Josema.
Try to add brackets to the begin and the end of the column name (not tested, but works in SQL Server):
SELECT * from TEST where TEST.[HD-TEST]='H'