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 |
romzilla
Starting Member
6 Posts |
Posted - 2007-11-15 : 02:55:00
|
HiI am new to SQL server (MS SQL Server 2005 Standart Edition) so maybe someone could help me with trigger problem. I have just gone through some material about triggers, but still some issues should be cleared. Let me try do describe the situationI have table profile, colums f_condition(integer), f_glabat_lidz(integer) and f_lietas_dat(date) in it. f_lietas_dat is filled by user in application but field f_glabat_lidz needs to be calculated automatically(f_glabat_lidz = year of f_lietas_dat + 5 if f_condition = 5f_glabat_lidz = year of f_lietas_dat + 10 if f_condition = 10 for example). This should be done on every insert or update. I created this example trigger, this is the idea, but it does not work. Maybe someone could help to solve this problem? It is very urgent! Thank You for help!CREATE TRIGGER profile_trgON profileFOR INSERT, UPDATEASBEGININSERT profile (f_glabat_lidz)SELECT YEAR(f_lietas_dat)+1FROM insertedEND |
|
elancaster
A very urgent SQL Yakette
1208 Posts |
|
|
|
|