By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,396 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

Create triggers

P: 7
I am a begginner in SQL Server

How to create a trigger in sql 2005,Before that I am using Oracle .There my trigger is like .......
create or replace trigger auto_empno before insert on
employ_det for each row
declare
a number;
begin
select nvl(max(to_number(substr(emp_no,3,length(emp_no)-2))),0)+1
into a from employ_det;
:new.emp_no:='AV'||a;
end;

How to convert this code into suitable for SQL Server
Apr 28 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
I am a begginner in SQL Server

How to create a trigger in sql 2005,Before that I am using Oracle .There my trigger is like .......
create or replace trigger auto_empno before insert on
employ_det for each row
declare
a number;
begin
select nvl(max(to_number(substr(emp_no,3,length(emp_no)-2))),0)+1
into a from employ_det;
:new.emp_no:='AV'||a;
end;

How to convert this code into suitable for SQL Server

Read more here

-- CK
Apr 28 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.