这个sql语句怎么写成access语句
gasky 2006-09-01 03:00:49
CREATE PROCEDURE Community_UsersRegisterUser
(
@communityID int,
@username NVarchar(100),
@password NVarchar(100),
@email NVarchar(150),
@firstName NVarchar(50),
@lastName NVarchar(50),
@timezone int,
@location NVarchar(200),
@occupation NVarchar(200),
@interests NVarchar(200),
@msn NVarchar(100),
@yahoo NVarchar(100),
@aim NVarchar(100),
@icq NVarchar(100),
@url NVarchar(200),
@fakeEmail NVarchar(150),
@enableNewsletter bit,
@enableNotifications bit
)
AS
-- Check if username already exists
IF EXISTS(SELECT User_ID FROM Community_Users WHERE User_CommunityID=@communityID AND User_Username = @username)
RETURN -1
-- Check if email already exists
IF EXISTS(SELECT User_ID FROM Community_Users WHERE User_CommunityID=@communityID AND User_Email = @email)
RETURN -2
-- Otherwise, register the new user
INSERT Community_Users
(
User_CommunityID,
User_Username,
User_Password,
User_Email,
User_FirstName,
User_LastName,
User_Timezone,
User_Location,
User_Occupation,
User_Interests,
User_MSN,
User_Yahoo,
User_AIM,
User_ICQ,
User_URL,
User_FakeEmail,
User_EnableNewsletter,
User_EnableNotifications
)
VALUES
(
@communityID,
@username,
@password,
@email,
@firstName,
@lastName,
@timezone,
@location,
@occupation,
@interests,
@msn,
@yahoo,
@aim,
@icq,
@url,
@fakeEmail,
@enableNewsletter,
@enableNotifications
)
RETURN @@IDENTITY
GO