When I attempt to create the stored procedure below I get the following error:
Operand type clash: uniqueidentifier is incompatible with int
It’s not clear to me what is causing this error. UserID is in fact an int in all of my tables. Can someone tell me what I’ve done wrong?
create procedure dbo.DeleteUser(@UserID int)
as
delete from [aspnet_Membership] where UserId = @UserID
delete from [Subscription] where UserID = @UserID
delete from [Address] where UserID = @UserID
delete from [User] where UserID = @UserID
go
Sounds to me like at least one of those tables has defined
UserIDas auniqueidentifier, not anint. Did you check the data in each table? What doesSELECT TOP 1 UserID FROMeach table yield? Anintor aGUID?EDIT
I think you have built a procedure based on all tables that contain a column named UserID. I think you should not have included the
aspnet_Membershiptable in your script, since it’s not really one of “your” tables.If you meant to design your tables around the
aspnet_Membershipdatabase, then why are the rest of the columnsintwhen that table clearly uses auniqueidentifierfor theUserIDcolumn?