Solved

SQL errors

Posted on 2003-12-01
3
238 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now