Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Need help moving from dbo.Users to dbo.aspnet_Users table.

 
   Database Help (Home) -> General Discussions RSS
Next:  Calculation based on Value List  
Author Message
pbd22

External


Since: Aug 12, 2008
Posts: 6



(Msg. 1) Posted: Wed Dec 10, 2008 12:18 pm
Post subject: Need help moving from dbo.Users to dbo.aspnet_Users table.
Archived from groups: comp>databases>ms-sqlserver (more info?)

Hi.

I have recently added the ASPNETDB tables to my database so I can take
advantage of
autentication / roles / groups and so on. From the online errata it
looks like I need to give
up my current Users table and add the columns I need from it to the
aspnet_Users table.
Is this correct? If so, I am worried about the migration from old to
new. Namely, I have some
constraints on the old Users table for checking if the same email
address exists on an insert and so on. Also, for columns that are
similar (such as userid) I am noticing that the types are different.
Would somebody mind advising me on the most graceful way to move (add
the columns and constraints) from the old Users table to aspnet_Users
without causing the application to go haywire? A plus is that this
application is in production so, there are currently no active users.

Thanks in advance.

USE [MyDBDev]
GO
/****** Object: Table [dbo].[Users] Script Date: 12/10/2008
14:04:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Users](
[userid] [int] IDENTITY(1,1) NOT NULL,
[lastname] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[firstname] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[email] [varchar](50) COLLATE Latin1_General_CI_AI NOT NULL,
[alternateemail] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[password] [varchar](50) COLLATE Latin1_General_CI_AI NOT NULL,
[securityquestion] [varchar](50) COLLATE Latin1_General_CI_AI NOT
NULL,
[securityanswer] [varchar](50) COLLATE Latin1_General_CI_AI NOT NULL,
[zipcode] [int] NOT NULL,
[birthmonth] [tinyint] NOT NULL,
[birthday] [tinyint] NOT NULL,
[birthyear] [int] NOT NULL,
[gender] [varchar](10) COLLATE Latin1_General_CI_AI NULL,
[city] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[state] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[country] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[registerdate] [datetime] NOT NULL,
[editdate] [datetime] NULL,
[confirmed] [bit] NULL CONSTRAINT [DF__Users__confirmed__4CC05EF3]
DEFAULT ((0)),
CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED
(
[userid] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [IX_email] UNIQUE NONCLUSTERED
(
[email] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

USE [MyDBDev]
GO
/****** Object: Table [dbo].[aspnet_Users] Script Date: 12/10/2008
14:04:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[aspnet_Users](
[ApplicationId] [uniqueidentifier] NOT NULL,
[UserId] [uniqueidentifier] NOT NULL DEFAULT (newid()),
[UserName] [nvarchar](256) COLLATE Latin1_General_CI_AI NOT NULL,
[LoweredUserName] [nvarchar](256) COLLATE Latin1_General_CI_AI NOT
NULL,
[MobileAlias] [nvarchar](16) COLLATE Latin1_General_CI_AI NULL
DEFAULT (NULL),
[IsAnonymous] [bit] NOT NULL DEFAULT ((0)),
[LastActivityDate] [datetime] NOT NULL,
PRIMARY KEY NONCLUSTERED
(
[UserId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
USE [MyDBDev]
GO
ALTER TABLE [dbo].[aspnet_Users] WITH CHECK ADD FOREIGN KEY
([ApplicationId])
REFERENCES [dbo].[aspnet_Applications]

 >> Stay informed about: Need help moving from dbo.Users to dbo.aspnet_Users table. 
Back to top
Login to vote
Erland Sommarskog2

External


Since: May 30, 2004
Posts: 2061



(Msg. 2) Posted: Thu Dec 11, 2008 6:28 pm
Post subject: Re: Need help moving from dbo.Users to dbo.aspnet_Users table. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

pbd22 ( ) writes:
> I have recently added the ASPNETDB tables to my database so I can take
> advantage of
> autentication / roles / groups and so on. From the online errata it
> looks like I need to give
> up my current Users table and add the columns I need from it to the
> aspnet_Users table.
> Is this correct?
> If so, I am worried about the migration from old to
> new. Namely, I have some
> constraints on the old Users table for checking if the same email
> address exists on an insert and so on. Also, for columns that are
> similar (such as userid) I am noticing that the types are different.
> Would somebody mind advising me on the most graceful way to move (add
> the columns and constraints) from the old Users table to aspnet_Users
> without causing the application to go haywire? A plus is that this
> application is in production so, there are currently no active users.

The aspnet_Users is unknown to me, but my gut reaction is that you
should add a ASP_UserID column to your users table that would hold the
user id in aspnet_Users. But I don't know how you add users to this
aspnet_Users table. I notice that its user id is a GUID with a default
of newid(). You would need a way to get that newid() to maintain your
own table.

You may be better off asking in an ASP .Net group where they may know
more about ASPNETDB.


--
Erland Sommarskog, SQL Server MVP, esquel.RemoveThis@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 >> Stay informed about: Need help moving from dbo.Users to dbo.aspnet_Users table. 
Back to top
Login to vote
Oscar Santiesteban

External


Since: Jun 17, 2008
Posts: 2



(Msg. 3) Posted: Fri Dec 12, 2008 8:57 pm
Post subject: Re: Need help moving from dbo.Users to dbo.aspnet_Users table. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> I have recently added the ASPNETDB tables to my database so I can take
> advantage of
> autentication / roles / groups and so on. From the online errata it
> looks like I need to give
> up my current Users table and add the columns I need from it to the
> aspnet_Users table.
> Is this correct? If so, I am worried about the migration from old to
> new. Namely, I have some
> constraints on the old Users table for checking if the same email
> address exists on an insert and so on. Also, for columns that are
> similar (such as userid) I am noticing that the types are different.
> Would somebody mind advising me on the most graceful way to move (add
> the columns and constraints) from the old Users table to aspnet_Users
> without causing the application to go haywire? A plus is that this
> application is in production so, there are currently no active users.

The last time we used this, the ASPNET database is a stand-alone database
that handles those security settings for your system. From what I saw, you
do not add these tables to your database, you merely point the security
controls in Visual Studio to this database. You may also see that if you
use a SQL SERVER database for your session variables, the name of the
database is also ASPNET by default. I believe there is plenty of
documentation on the microsoft site about this.

Oscar..
 >> Stay informed about: Need help moving from dbo.Users to dbo.aspnet_Users table. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Moving log files - If I use attach/detach to move my log file to a different drive, will it break any of my permissions for the sql logins. If so, how can I fix this. This all stemmed from needing to setup log shipping to another server for redundancy. Step 1 says to..

Create Table with Variable included in Table Name - Hi, I am trying to create a routine for generating tables from a master response table. The end result would increment the variable "somevalue" by one and then create the next table (ie: TESTTEST2). Is there a way to insert the variable into...

SP To create table - I have a stored procedure to create a table. In my program I want the user to name the table to be created, therefore I pass a parameter to the SP for the table name. I cannot get it to work. It creates a table called "@NewTableName". Any i...

Email on insert in a table - Hi, I wish to use email functionality of sql to send me an email when an insert is performed on a particular table. I know that a proc and may be a trigger is required. Can someone please provide me some hints. Thanks, Guju

Find Table Size - Env: SQL Server 2000 The following sql stmt seems to find a particular table's size programmatically: select top 1 [rows],rowcnt from sysindexes where ID = object_id('aUserTable') <font color=purple> ; and status = 0</font> <font...
   Database Help (Home) -> General Discussions All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]