开发者

how to check data is inserted or not in stored procedure

开发者 https://www.devze.com 2023-02-10 07:29 出处:网络
i have creating a stored procedure to insert employee details.if this query is executed in form it will not return any value.

i have creating a stored procedure to insert employee details.if this query is executed in form it will not return any value.

create PROCEDURE  [dbo].[employee_mst_insertvalues]
@e_firstname varchar(100),
@e_middlename varchar(100),
@e_lastname varchar(100),
@e_address varchar(1000),
@e_phoneno varchar(开发者_开发百科15),
@mobileno varchar(15),
@UploadPhoto image

AS
declare @employee_id int
BEGIN
    SET @employee_id=(select max(Employee_id) from mstEmployee)
    if @employee_id is null
    BEGIN
        set @employee_id=1
END
    else
BEGIN
        set @employee_id=@employee_id+1
END
insert into mstEmployee (Employee_id,E_FirstName,E_MiddleName,E_LastName,E_Address,E_PhoneNo,E_MobileNo,UploadPhoto) 
values(@employee_id,@e_firstname,@e_middlename,@e_lastname,@e_address,@e_phoneno,@mobileno,@UploadPhoto)
END

how can i return a integer value to check whether data is inserted or not.


SELECT @@ROWCOUNT will give you the number of rows affected by the insert statement.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号