USE [ACCOUNT_DBF]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_createAccount]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[usp_createAccount]
GO
USE [ACCOUNT_DBF]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[usp_createAccount] [USER=162874]account[/USER] varchar(32),
@pw varchar(32), [USER=315880]cas[/USER]h int = 0, [USER=213273]email[/USER] varchar(100) = '',
@gefra smallint = 0,
@geant varchar(50), [USER=848971]Birth[/USER]day varchar(10),
@ip varchar(39), [USER=1333467003]Lang[/USER] varchar(3)
as
set nocount on
set xact_abort on
if not exists (select * from ACCOUNT_TBL where account = [USER=162874]account[/USER])
begin
begin tran
INSERT ACCOUNT_TBL(account,password,isuse,member,id_no1,id_no2,realname,OldPassword,cash)
VALUES [USER=162874]account[/USER], @pw, 'T', 'A', @pw, @pw, 'P',@pw, [USER=315880]cas[/USER]h)
INSERT ACCOUNT_TBL_DETAIL(account,gamecode,tester,m_chLoginAuthority,regdate,BlockTime,EndTime,WebTime,isuse,secession, email,secretquestion,secretanswer,birthday,regIP)
VALUES [USER=162874]account[/USER],'A000','2','F',GETDATE(),CONVERT(CHAR(8),GETDATE()-1,112),CONVERT(CHAR(8),DATEADD(year,10,GETDATE()),112),CONVERT(CHAR(8),GETDATE()-1,112),'T',NULL, [USER=213273]email[/USER], @gefra, @geant, [USER=848971]Birth[/USER]day,@ip)
if @@error <> 0
begin
rollback tran
select -1
end
else
begin
commit tran
select 1
end
end
else
begin
select 0
end
GO