HI, in DR if you link the fields to DNN core profile properties, then the profile should note the following SQL tables (users, userprofile,profilepropertydefinition). From the "users" table, you get the userid, from "userprofile" table, you get their profile information which is also tied to the DNN "profilepropertydefinition" where you obtain the ID number of the profile. Here's an example of a stored procedure to add user roles as well as update or insert user profile property definition. alter procedure usp_AddRoleUserAge (@UserID int,@BirthDate nvarchar(30)) as begin declare @RoleID int --declare @ExpiryDate datetime declare @EffectiveDate datetime declare @CalcAge datetime declare @IsTrialUsed bit set @EffectiveDate = getdate() --set @ExpiryDate = null set @IsTrialUsed = 'True' set @CalcAge = datediff(year,convert(datetime,@BirthDate),@EffectiveDate) -- age range: (Under 18, 18-24, 25-30, 30+) if (@CalcAge < 18) begin set @RoleID = 28 if exists(select roleid from userroles where userid = @UserID and roleid = @RoleID) begin delete from UserRoles where userid = @UserID and roleid = @RoleID end else begin insert into UserRoles(UserID,RoleID,IsTrialUsed,EffectiveDate) values(@UserID,@RoleID,@IsTrialUsed,@EffectiveDate) end end if (@CalcAge between 18 and 24) begin set @RoleID = 42 if exists(select roleid from userroles where userid = @UserID and roleid = @RoleID) begin delete from UserRoles where userid = @UserID and roleid = @RoleID end else begin insert into UserRoles(UserID,RoleID,IsTrialUsed,EffectiveDate) values(@UserID,@RoleID,@IsTrialUsed,@EffectiveDate) end end if (@CalcAge between 25 and 30) begin set @RoleID = 43 if exists(select roleid from userroles where userid = @UserID and roleid = @RoleID) begin delete from UserRoles where userid = @UserID and roleid = @RoleID end else begin insert into UserRoles(UserID,RoleID,IsTrialUsed,EffectiveDate) values(@UserID,@RoleID,@IsTrialUsed,@EffectiveDate) end end if (@CalcAge > 30) begin set @RoleID = 25 if exists(select roleid from userroles where userid = @UserID and roleid = @RoleID) begin delete from UserRoles where userid = @UserID and roleid = @RoleID end else begin insert into UserRoles(UserID,RoleID,IsTrialUsed,EffectiveDate) values(@UserID,@RoleID,@IsTrialUsed,@EffectiveDate) end end -- set the three DNN core profile fields (PrefStoryCommentNotification,NotificationEmails,InvitationEmails) -- in table "UserProfile" to true; note: need to retrieve PropertyDefinitionID from "ProfilePropertyDefinition" -- table declare @PrefStoryCommentNotificationID int declare @NotificationEmailsID int declare @InvitationEmailsID int declare @PublicBirthdayID int declare @MMPhotoNotifyCmtID int declare @MMGCommentNotifyID int declare @BlogOwnerCommentNotifyID int declare @BlogReaderCommentNotifyID int set @PrefStoryCommentNotificationID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'PrefStoryCommentNotification') set @NotificationEmailsID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'NotificationEmails') set @InvitationEmailsID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'InvitationEmails') set @PublicBirthdayID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'PublicBirthday') set @MMPhotoNotifyCmtID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'MMPhotoNotifyCmt') set @MMGCommentNotifyID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'MMGCommentNotify') set @BlogOwnerCommentNotifyID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'BlogOwnerCommentNotify') set @BlogReaderCommentNotifyID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'BlogReaderCommentNotify') if not exists(select userid from UserProfile where userid = @UserID and PropertyDefinitionID in (@PrefStoryCommentNotificationID,@NotificationEmailsID,@InvitationEmailsID,@PublicBirthdayID,@MMPhotoNotifyCmtID,@MMGCommentNotifyID,@BlogOwnerComment NotifyID,@BlogReaderCommentNotifyID)) begin insert into UserProfile(UserID,PropertyDefinitionID,PropertyValue,Visibility,LastUpdatedDate) values(@UserID,@PrefStoryCommentNotificationID,'True',2,getdate()) insert into UserProfile(UserID,PropertyDefinitionID,PropertyValue,Visibility,LastUpdatedDate) values(@UserID,@NotificationEmailsID,'True',2,getdate()) insert into UserProfile(UserID,PropertyDefinitionID,PropertyValue,Visibility,LastUpdatedDate) values(@UserID,@InvitationEmailsID,'True',2,getdate()) insert into UserProfile(UserID,PropertyDefinitionID,PropertyValue,Visibility,LastUpdatedDate) values(@UserID,@PublicBirthdayID,'True',2,getdate()) insert into UserProfile(UserID,PropertyDefinitionID,PropertyValue,Visibility,LastUpdatedDate) values(@UserID,@MMPhotoNotifyCmtID,'True',2,getdate()) insert into UserProfile(UserID,PropertyDefinitionID,PropertyValue,Visibility,LastUpdatedDate) values(@UserID,@MMGCommentNotifyID,'True',2,getdate()) insert into UserProfile(UserID,PropertyDefinitionID,PropertyValue,Visibility,LastUpdatedDate) values(@UserID,@BlogOwnerCommentNotifyID,'True',2,getdate()) insert into UserProfile(UserID,PropertyDefinitionID,PropertyValue,Visibility,LastUpdatedDate) values(@UserID,@BlogReaderCommentNotifyID,'True',2,getdate()) end end See if this example SQL helps you out. -- David |