一个简单的存储过程
真的很简单,但因为网络上很难找简单的存储过程来学习,所以贴上来。
ALTER PROCEDURE dbo.InsertCompany
(
@Name nchar(100) ,
@Url nchar(100),
@Point smallint
)
AS
if NOT EXISTS(SELECT * from tblCompany WHERE CompanyUrl = @Url)
BEGIN
INSERT INTO tblCompany VALUES (@Name, @Url, @Point)
RETURN 1
END
else
RETURN 0
ALTER PROCEDURE dbo.InsertCompany
(
@Name nchar(100) ,
@Url nchar(100),
@Point smallint
)
AS
if NOT EXISTS(SELECT * from tblCompany WHERE CompanyUrl = @Url)
BEGIN
INSERT INTO tblCompany VALUES (@Name, @Url, @Point)
RETURN 1
END
else
RETURN 0