Solved

SQL errors

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Replace &lt; with < 14 59
Server Error 11 58
Reading the Web.Config using IIS 7.5? 4 36
Firing an ASP.NET event on selection of a JQuery datepicker 4 16
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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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