Solved

SQL errors

Posted on 2003-12-01
3
237 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
Comment Utility
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
Comment Utility
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
Comment Utility
yay! thanks!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

17 Experts available now in Live!

Get 1:1 Help Now