1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[createAccount]
@account varchar(32),
@pw varchar(32),
@cash int = 0,
@vote int = 0,
@totalcash int = 0,
@email varchar(100) = '',
@birthday varchar(100) = ''
as
set nocount on
set xact_abort on
if not exists (select * from ACCOUNT_TBL where account = @account)
begin
begin tran
INSERT ACCOUNT_TBL(account,password,isuse,member,id_no1,id_no2,realname,cash,vote,totalcash)
VALUES(@account, @pw, 'T', 'A', '', '', '', @cash,@vote,@totalcash)
INSERT ACCOUNT_TBL_DETAIL(account,gamecode,tester,m_chLoginAuthority,regdate,BlockTime,EndTime,WebTime,isuse,secession, email, birthday)
VALUES(@account,'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, @email, @birthday)
insert AccountPlay (Account, PlayDate)
select @account, convert(int, convert(char(8), getdate(), 112))
if @@error <> 0
begin
rollback tran
select -1
end
else
begin
commit tran
select 1
end
end
else
begin
select 0
end |
Partager