:VERSION 1

BEGIN TRANSACTION

CREATE TABLE [Avatars] (
[PrincipalID] uniqueidentifier NOT NULL, 
[Name] varchar(32) NOT NULL, 
[Value] varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY CLUSTERED 
(
	[PrincipalID] ASC, [Name] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


COMMIT

:VERSION 2

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_Avatars
	(
	PrincipalID uniqueidentifier NOT NULL,
	[Name] varchar(32) NOT NULL, 
	Value text NOT NULL DEFAULT '',
	)  ON [PRIMARY]
	 TEXTIMAGE_ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.Avatars)
	 EXEC('INSERT INTO dbo.Tmp_Avatars (PrincipalID, Name, Value)
		SELECT PrincipalID, CONVERT(text, Name), Value FROM dbo.Avatars WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.Avatars

EXECUTE sp_rename N'dbo.Tmp_Avatars', N'Avatars', 'OBJECT' 

COMMIT

:VERSION 3

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_Avatars
	(
	PrincipalID uniqueidentifier NOT NULL,
	[Name] varchar(32) NOT NULL, 
	Value text NOT NULL DEFAULT '',
	PRIMARY KEY CLUSTERED 
(
	[PrincipalID] ASC, [Name] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
	 TEXTIMAGE_ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.Avatars)
	 EXEC('INSERT INTO dbo.Tmp_Avatars (PrincipalID, Name, Value)
		SELECT PrincipalID, CONVERT(text, Name), Value FROM dbo.Avatars WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.Avatars

EXECUTE sp_rename N'dbo.Tmp_Avatars', N'Avatars', 'OBJECT' 
COMMIT