Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect syntax near the keyword "Primary"

I have this error message but i cannot find any wrongdoing, help?

const string sql = @"SELECT PrimarySchool,TopHonour,Cca,TopStudent,TopAggregate,TopImage FROM Primary";
like image 224
GJJ Avatar asked May 09 '11 08:05

GJJ


1 Answers

primary is a reserved keyword in TSQL. Make it SELECT ...(snipped)... FROM [Primary]" to escape it and indicate you mean the object named Primary.

like image 117
Marc Gravell Avatar answered Oct 19 '22 07:10

Marc Gravell