Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL errors

Posted on 2003-12-01
3
Medium Priority
?
247 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
  • 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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Loops Section Overview
Suggested Courses
Course of the Month5 days, 22 hours left to enroll

773 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