34,588
社区成员
发帖
与我相关
我的任务
分享
CREATE PROCEDURE [dbo].[InsertComment] @ProductID int, @Comments VARCHAR(255)
AS
BEGIN
IF ((select count(*) from
gosalesdw.ProductComments
where ProductID = @ProductID) = 0)
INSERT INTO gosalesdw.ProductComments VALUES (@ProductID,@Comments)
ELSE
UPDATE gosalesdw.ProductComments
SET Comment = @Comments WHERE ProductID = @ProductID
END
Select ProductID,Comment from gosalesdw.ProductComments
GO
CREATE PROCEDURE [dbo].[InsertComment] @ProductID int, @Comments VARCHAR(255)
AS
BEGIN
IF ((select count(*) from
gosalesdw.ProductComments
where ProductID = @ProductID) = 0)
INSERT INTO gosalesdw.ProductComments VALUES (@ProductID,@Comments)
ELSE
UPDATE gosalesdw.ProductComments
SET Comment = @Comments WHERE ProductID = @ProductID
END
Select ProductID,Comment from gosalesdw.ProductComments
GO
CREATE PROCEDURE [dbo].[InsertComment] @ProductID int, @Comments VARCHAR(255)
AS
BEGIN
IF ((select count(*) from
gosalesdw.ProductComments
where ProductID = @ProductID) = 0)
INSERT INTO gosalesdw.ProductComments VALUES (@ProductID,@Comments) --多了换行符
ELSE
UPDATE gosalesdw.ProductComments
SET Comment = @Comments WHERE ProductID = @ProductID
END
Select ProductID,Comment from gosalesdw.ProductComments
GO