Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

empty object or column names error

Status
Not open for further replies.

yahoo182

Programmer
Jul 5, 2005
70
CA
Hi there,
I have a c sharp file that reads in a text file and add the fields to my MYSQL server db.

My table is defined as:
"CREATE TABLE images(hotelID int, Name varchar(40), Caption varchar(20), URL varchar(100), Supplier varchar(20), Width int, Height int, ByteSize int, ThumbNailURL varchar(100))";


and I have the statement

INSERT INTO images VALUES(4110, "Exterior", "", " "HRN", 328, 220, 19394, "
and notice that the 3rd field is null, but as in the table definition, the Caption column should take null values (it is indicated so in the enterprise manager)

The error I get is

The name 'Exterior' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
Cannot use empty object or column names. Use a single space if necessary.


Any sort of feedback is greatly appriciated.
I have been trying stuff the whole day with no luck ....

thanks
 
Try replacing the " (double quotes) with ' (single quotes).
All strings in sql server are inserted with single quotes.

Regards,
AA

 
I am not familier with c sharp but I see double quotes in your create stmt. So shouldn't the insert stmt also be in double quotes?
Something like this?
Code:
"INSERT INTO images VALUES(4110, 'Exterior', '', '[URL unfurl="true"]http://images.travelnow.com/hotels/ACY_RESO-exter-3.jpg',[/URL] 'HRN', 328, 220, 19394, '[URL unfurl="true"]http://images.travelnow.com/hotels/thumbs/ACY_RESO-exter-3-thumb.jpg')";[/URL]

Regards,
AA
 
to my MYSQL server db
This forum is for Microsoft's SQL Server which uses the TSQL form of SQL. Please post your query in a TEK-TIPS MySQL forum.

-SQLBill

Posting advice: FAQ481-4875
 
Thanks for the help guys. Yes MS SQL server takes single instead of double quotes it seems. It worked out just fine.

I will be more careful where I post my stuff. I wasn't too sure coz this was sort of a Q that relates to both my/ms sql.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top