Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
aamir1
Starting Member
2 Posts |
Posted - 2006-12-08 : 00:20:41
|
| hy guysi m trying to create trigger but i tired to get an error msgtrigger which i want to create is :CREATE TRIGGER TR_TESTING ON EMPLOYEESFOR INSERTASDECLARE @TMP AS VARCHAR(1)SET @TMP=SUBSTRING(FirstName,0,1) FROM EMPLOYEESIF @TMP='A' BEGIN INSERT INTO EMPLOYEES(LastName,FirstName) VALUES('DHARANI','AAMIR') ENDELSE BEGIN PRINT 'INSERT VALID RECORD' END**** but i got an error msg Incorrect syntax near the keyword 'FROM'.plz guide me abt this problem as soon as possible |
|
|
madhuotp
Yak Posting Veteran
78 Posts |
Posted - 2006-12-08 : 00:28:41
|
| it should be Select instead of SETFor :SET @TMP=SUBSTRING(FirstName,0,1) FROM EMPLOYEESReadSelect @TMP=SUBSTRING(FirstName,0,1) FROM EMPLOYEESMadhu |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-12-08 : 02:41:19
|
| <<SET @TMP=SUBSTRING(FirstName,0,1) FROM EMPLOYEES>>1 Use SELECT if you want to assign value to variable from table2 Make sure the query returns only one valueMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|