大家好我已经编写了这个存储过程,但是它中有一个错误
无法在nvarchar上调用方法
T-SQL代码:
ALTER PROCEDURE dbo.User_Announcement_Create
@Announcement nvarchar(250),
@UserName nvarchar(256)
AS
BEGIN
DECLARE @NewAnnouncement nvarchar(250)
SELECT @NewAnnouncement = NULL
IF( @UserName.dbo.Announcements IS NULL )
( SELECT UserName FROM dbo.aspnet_Users
WHERE @UserName = UserName )
RETURN -1
END
DECLARE @CreateAnnouncement bit
DECLARE @ReturnValue int
SET @ReturnValue = 0
SELECT @NewAnnouncement = Announcement FROM Announcements
SET @CreateAnnouncement = 1
INSERT INTO Announcements (Announcement, UserName)
VALUES (@Announcement, @UserName)
有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
替换此部分
IF( @UserName.dbo.Announcements IS NULL ) -- not understandable what are you doing here
用这个
IF( @UserName IS NULL )