‘Invalid column name’ error in SQL update statement

I was getting this error in my SQL statement, which was dynamically created in some C# code:

Invalid column name “385f35a5-697a-4238-b502-c5a72199d9c2”

An example of the statement:

INSERT INTO Test (ID)
VALUES ("385f35a5-697a-4238-b502-c5a72199d9c2")

This error was because my SQL INSERT statement had used double quotes around the text to be inserted instead of single quotes. Modifying the statement fixed it:

INSERT INTO Test (ID)
VALUES ('385f35a5-697a-4238-b502-c5a72199d9c2')
Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: