create table UserAgents (
  ProfileID NVARCHAR(255) not null,
   AgentIP NVARCHAR(24) null,
   AgentPort INT null,
   AgentOnline BIT null,
   SessionID NVARCHAR(255) null,
   SecureSessionID NVARCHAR(255) null,
   InitialRegion NVARCHAR(255) null,
   Region NVARCHAR(255) null,
   LoginTime INT null,
   LogoutTime INT null,
   Handle BIGINT null,
   primary key (ProfileID)
)

create table UserProfiles (
  ID NVARCHAR(255) not null,
   FirstName NVARCHAR(32) null,
   SurName NVARCHAR(32) null,
   PasswordHash NVARCHAR(32) null,
   PasswordSalt NVARCHAR(32) null,
   WebLoginKey NVARCHAR(255) null,
   HomeRegionX INT null,
   HomeRegionY INT null,
   HomeLocationX REAL null,
   HomeLocationY REAL null,
   HomeLocationZ REAL null,
   HomeLookAtX REAL null,
   HomeLookAtY REAL null,
   HomeLookAtZ REAL null,
   Created INT null,
   LastLogin INT null,
   RootInventoryFolderID NVARCHAR(255) null,
   UserInventoryURI NVARCHAR(255) null,
   UserAssetURI NVARCHAR(255) null,
   Image NVARCHAR(255) null,
   FirstLifeImage NVARCHAR(255) null,
   AboutText NVARCHAR(255) null,
   FirstLifeAboutText NVARCHAR(255) null,
   primary key (ID)
)
create table UserAppearances (
  Owner NVARCHAR(255) not null,
   BodyItem NVARCHAR(255) null,
   BodyAsset NVARCHAR(255) null,
   SkinItem NVARCHAR(255) null,
   SkinAsset NVARCHAR(255) null,
   HairItem NVARCHAR(255) null,
   HairAsset NVARCHAR(255) null,
   EyesItem NVARCHAR(255) null,
   EyesAsset NVARCHAR(255) null,
   ShirtItem NVARCHAR(255) null,
   ShirtAsset NVARCHAR(255) null,
   PantsItem NVARCHAR(255) null,
   PantsAsset NVARCHAR(255) null,
   ShoesItem NVARCHAR(255) null,
   ShoesAsset NVARCHAR(255) null,
   SocksItem NVARCHAR(255) null,
   SocksAsset NVARCHAR(255) null,
   JacketItem NVARCHAR(255) null,
   JacketAsset NVARCHAR(255) null,
   GlovesItem NVARCHAR(255) null,
   GlovesAsset NVARCHAR(255) null,
   UnderShirtItem NVARCHAR(255) null,
   UnderShirtAsset NVARCHAR(255) null,
   UnderPantsItem NVARCHAR(255) null,
   UnderPantsAsset NVARCHAR(255) null,
   SkirtItem NVARCHAR(255) null,
   SkirtAsset NVARCHAR(255) null,
   Texture VARBINARY(8000) null,
   VisualParams VARBINARY(8000) null,
   Serial INT null,
   primary key (Owner)
)

create index user_surname on UserProfiles (SurName)
create index user_firstname on UserProfiles (FirstName)
