Solved

SQL errors

Posted on 2003-12-01
3
245 Views
Last Modified: 2010-04-16
string select_test = "CREATE TRIGGER test_trig" +
"ON test" +
"AFTER INSERT" +
"AS" +
"INSERT INTO test_temp (code, name, grade)" +
"SELECT code, name, grade" +
"FROM inserted";

Can anyone tell me why the code above throws the following error?

"Line1: Incorrect syntax near 'testAFTER'
0
Comment
Question by:pikapi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Expert Comment

by:TheAvenger
ID: 9853926
Just put a space before every closing " on every line. The way you did it, the text becomes one, without any spaces.
0
 
LVL 20

Accepted Solution

by:
TheAvenger earned 50 total points
ID: 9853932
So, just make it:

string select_test = "CREATE TRIGGER test_trig " +
"ON test " +
"AFTER INSERT " +
"AS " +
"INSERT INTO test_temp (code, name, grade) " +
"SELECT code, name, grade " +
"FROM inserted";
0
 

Author Comment

by:pikapi
ID: 9854005
yay! thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question