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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 function inside the procedure

Author  Topic 

desikankannan
Posting Yak Master

152 Posts

Posted - 2008-01-29 : 10:56:13
i have created the table empid,empname,dob,salary for the insert i need to create procedure of insert empid,empname,dob,salary i got the function for autogenerated number for empid
mmy question how to put function inside the procedure?
my function below,pls guide me its very urgent.
create function NextCustomerNumber()
returns char(5)
as
begin
declare @lastval char(5)
set @lastval = (select max(customerNumber) from Customers)
if @lastval is null set @lastval = 'C0001'
declare @i int
set @i = right(@lastval,4) + 1
return 'C' + right('000' + convert(varchar(10),@i),4)
end

Desikankannan

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-01-29 : 16:08:17
Duplicate Post:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=96391

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -