Answer Posted / vijayalakshmi u
Create Table emp
(
dbID int NOT NULL IDENTITY (1,1) PRIMARY KEY,
customerNumber NVARCHAR(100) auto_increment,
Name Varchar(100)
)
Create function CustomerNumber (@id int)
returns varchar(10)
as
begin
DECLARE @ret varchar(10) ;
select @ret='gt' + right('0000' + convert(varchar(10), @id), 4)
RETURN @ret
end
create trigger emp_insert on emp
after insert as
update emp
set
emp.customerNumber = dbo.CustomerNumber(emp.dbID)
from
emp inner join
inserted on emp.dbID= inserted.dbID
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What does null mean?
What are the system database in sql server 2008?
Explain the relational database management system (rdbms)?
SQL Server Architecture ?
How to move database physical files in ms sql server?
what is difference between view and Dip.
What is the difference between dropping a database and taking a database offline?
How to view existing indexes on an given table using sp_help?
How do we synchronize On-Premise SQL server with SQL Azure?
What is a select query statement in ms sql server?
Explain can SSRS reports Cache results?
What is cdc in sql server?
What is a cache in ssrs?
How to rebuild indexes with alter index ... Rebuild?
how to create a scrollable cursor with the scroll option? : Sql server database administration