解决方案 »
- 错误 2 验证 (XHTML 1.0 Transitional): 在“body”元素的开始标记与结束标记之间不允许出现文本。 D:\asp\asp.netC\
- 菜鸟存储过程
- 表分区的问题, 求助?
- 怎样使用 sql 语句进行分页.?
- 急:如何一次性修改所有表的字段类型?
- 这个表该如何设计,极常见而且极富有挑战性的问题……
- 这个分组求和语句可把我给难住了,有兴趣的近来试试!
- 请问如果我只想让SQLsr做配合ASP的WEB应用我该如何安装配置呢?
- 在SQLServer中,如何设置,使得用户表中密码列为*,或者隐藏密码列
- ★★Sybase sql anywhere 有无压缩数据库的命令,穷问题
- 根据表有几行在报表显示成一行
- 请问,如何更新某字段为自然数?谢谢!
如,身份验证改为混合模式
set QUOTED_IDENTIFIER ON
go
--
ALTER procedure [dbo].[usp_insert_character]
@owner int
, @slot tinyint
, @name varchar(17)
, @type smallint
, @job smallint
, @f_type tinyint -- 0:공격형, 1:마법형, 2:감각형, 3:매력형, @pts_p tinyint
, @pts_m tinyint
, @pts_s tinyint
, @pts_c tinyint
, @zone smallint
, @home smallint
, @hair tinyint
--with encryption
as
set nocount on
set lock_timeout 10000 declare @error int
, @char_uid int
, @getdate datetime
, @slotcount tinyint
, @exist_char int
, @available_char_name bit
, @user_netid varchar(13)
, @exist_netid varchar(13)
, @error_msg nvarchar(50)
, @next_uid bigint
, @ears_item int
, @tail_item int set @error = 0
set @getdate = getdate()
set @available_char_name = 1 select @slotcount = count(*)
from char_attr as C
inner join char_state as S on S.uid = C.uid
where owner = @owner and authority <> 2 if (@slotcount > 2)
begin
set @error = 1020
set @error_msg = 'Overflow slot count!!'
goto ErrorHandling
end if (@error = 0)
begin
select @exist_char = C.uid
from char_attr as C
inner join char_state as S on S.uid = C.uid
where owner = @owner and authority <> 2 and slot = @slot if (@@rowcount > 0)
begin
set @error = 1021
set @error_msg = 'Already exist slot number!!'
end
end select @char_uid = uid
from char_attr
where [name] = @name
if (@@rowcount > 0)
begin
set @error = 1023
set @error_msg = 'Already exist character name!!'
goto ErrorHandling
end
-- select @char_uid = char_uid
from tbl_sleep_char
where char_name = @name
and wakeup_date is null
and coupon_code > 0
if (@@rowcount > 0)
begin
set @error = 1023
set @error_msg = 'Already exist character name!!'
goto ErrorHandling
end
if ( dbo.fn_CharacterName_ValidCheck (@name) = 0)
begin
set @error = 1019
set @error_msg = 'Invalid character name!!'
goto ErrorHandling
end
--
if(@getdate > '2011-01-12 00:00:00' and @getdate < '2011-02-24 11:00:00')
begin
--
exec usp_user_new_user_char_create @owner
end
begin tran ------------------------>
insert into char_attr (owner, slot, [name], type, job, f_type, pts_p, pts_m, pts_s, pts_c, gen_time, type_2, job_2, job_2_changed, transgender_date, type_3, job_3, job_3_changed, change_job_queststate)
values (@owner, @slot, @name, @type, @job, @f_type, @pts_p, @pts_m, @pts_s, @pts_c, @getdate, 0, 0, @getdate, '2000-01-01', 0, 0, @getdate, 0)
if (@@error = 0)
set @char_uid = @@IDENTITY
else
begin
set @error = 9001
set @error_msg = 'char_attr Insert Fail!!'
goto Errorhandling
end
-- Insert Status
insert into char_status (uid, ap_pts, ac_pts, dx_pts, max_mp_pts, ma_pts, md_pts, max_wt_pts, da_pts, lk_pts, max_hp_pts, dp_pts, hv_pts, attr_pts
, tm_level_p, tm_level_m, tm_level_s, tm_level_c, [level], tm_point, tm_level, tm_exp, tutorial_step )
values (@char_uid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ) -- 본섭용
-- values (@char_uid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 200, 200, 0, 0 ) -- 테섭용 tmlevel = 200, level =200, tmpoint = 200
if (@@error <> 0)
begin
set @error = 9002
set @error_msg = 'char_status Insert Fail!!'
goto Errorhandling
end
-- Insert State
insert into char_state (uid, state, authority, zone, pos_x, pos_y, home, [money], hp, mp, tm_exp_p, tm_exp_m, tm_exp_s, tm_exp_c
, [exp], login_time, logout_time, total_con_time, hair, hair_2, job_state, wh_slots, hair_3 )
values (@char_uid, 0, 0, @zone, 0, 0, @home, 0, 0, 0, 0, 0, 0, 0, 0, @getdate, @getdate, 0, @hair, 0, 1, 80, 0) -- 본섭용
--values (@char_uid, 0, 0, @zone, 0, 0, @home, 10000000, 0, 0, 0, 0, 0, 0, 0, @getdate, @getdate, 0, @hair, 0, 1, 80, 0) -- 테섭용
if (@@error <> 0)
begin
set @error = 9003
set @error_msg = 'char_state Insert Fail!!'
goto Errorhandling
end --
select @ears_item = case @type
when 1 then 6900
when 2 then 6901
when 3 then 6902
when 4 then 6903
when 5 then 6904
when 6 then 6905
when 7 then 6906
when 8 then 6907
end
, @tail_item = case @type
when 1 then 6950
when 2 then 6951
when 3 then 6952
when 4 then 6953
when 5 then 6954
when 6 then 6955
when 7 then 6956
when 8 then 6957
end
-- 귀
insert into tbl_item values (@ears_item, 2, 1, 0, default, 0, 0, 0, 0)
insert into tbl_item_char values (@char_uid, @@IDENTITY, 0, 5)
-- 꼬리
insert into tbl_item values (@tail_item, 2, 1, 0, default, 0, 0, 0, 0)
insert into tbl_item_char values (@char_uid, @@IDENTITY, 0, 6)
-- 복표션(HP, MP)
-- 2008.06.26
insert into tbl_item values (2006, 1, 30, 0, default, 0, 0, 0, 0)
insert into tbl_item_char values (@char_uid, @@IDENTITY, 1, 0)
insert into tbl_item values (2206, 1, 30, 0, default, 0, 0, 0, 0)
insert into tbl_item_char values (@char_uid, @@IDENTITY, 1, 0)
/*
--
insert into tbl_item values (8000, 2, 600, 0, default, 0, 0, 0, 0)
insert into tbl_item_char values (@char_uid, @@IDENTITY, 1, 0)
*/
/*
--
declare @get_item_index int
select @get_item_index = case @f_type
when 0 then 27012
when 1 then 28014
when 2 then 29015
when 3 then 30013
end
--
insert into tbl_item values (@get_item_index, 1, 1, 0, default, 0, 0, 0, 0)
insert into tbl_item_char values (@char_uid, @@IDENTITY, 1, 0)
*/
--2010.07.28
declare @get_skill_index int
select @get_skill_index = case @f_type
when 0 then 1012
when 1 then 2014
when 2 then 3015
when 3 then 4013
end
insert into tbl_skill values (@char_uid, @get_skill_index, 1, @getdate)
if (@@error <> 0)
begin
set @error = 105
set @error_msg = 'tbl_skill insert fail'
goto ErrorHandling
end -- Insert Mycamp Slot
--
insert into tbl_mycamp_slot (char_uid, slot_name, slot_uptodate)
values ( @char_uid, 'mycamp 1', @getdate)
if (@@error <> 0)
begin
set @error = 105
set @error_msg = 'tbl_mycamp_slot insert fail'
goto ErrorHandling
end declare @slot_code int
, @user_uid int
, @cell_uid bigint
, @wall1_uid bigint
, @wall2_uid bigint
set @cell_uid = 0
set @wall1_uid = 0
set @wall2_uid = 0 set @slot_code = @@IDENTITY select @user_uid = owner
from char_attr
where uid = @char_uid -- 셀 1개, 벽 2개 생성
-- (user_uid, item_index, item_where, item_buy_date, item_use_date, item_use_time, item_flag, sell_code, sell_type)
-- 셀(cell) : 18001
insert into tbl_mycamp_item values (@user_uid, 18001, 1, @getdate, @getdate, 0, 0, 0, 0 )
set @cell_uid = @@IDENTITY
-- 벽(wall) : 18002
insert into tbl_mycamp_item values (@user_uid, 18002, 1, @getdate, @getdate, 0, 0, 0, 0 )
set @wall1_uid = @@IDENTITY
insert into tbl_mycamp_item values (@user_uid, 18002, 1, @getdate, @getdate, 0, 0, 0, 0 )
set @wall2_uid = @@IDENTITY
if (@cell_uid > 0 and @wall1_uid > 0 and @wall2_uid > 0)
begin
insert into tbl_mycamp_deco values ( @slot_code, @cell_uid, 2400, 2400, 0, 0, @cell_uid )
insert into tbl_mycamp_deco values ( @slot_code, @wall1_uid, 0, -120, 0, 0, @cell_uid )
insert into tbl_mycamp_deco values ( @slot_code, @wall2_uid, 0, -120, 0, 1, @cell_uid )
if(@@error <> 0)
begin
set @error = 105
set @error_msg = 'tbl_mycamp_slot insert fail'
goto ErrorHandling
end
end
else
begin
set @error = 105
set @error_msg = 'tbl_mycamp_slot insert fail'
goto ErrorHandling
end
--
declare @r int
exec @r = usp_user_set_mycamp_item @user_uid
if(@r <> 0)
begin
set @error = @r
set @error_msg = 'usp_user_set_mycamp_item'
goto ErrorHandling
end
--
insert into tbl_drill_digup values (@char_uid, 0, 0, @getdate)
if(@@error <> 0)
begin
set @error = 105
set @error_msg = 'tbl_drill_digup insert fail'
goto ErrorHandling
end
--
insert into tbl_couple_char values (@char_uid, 0, 0, 0, 0, 0, 0, @getdate)
if(@@error <> 0)
begin
set @error = 105
set @error_msg = 'tbl_couple_char insert fail'
goto ErrorHandling
end
--
/*
update char_status
set ap_pts = (200-1) * C.pts_p,
ac_pts = (200-1) * C.pts_p,
dx_pts = (200-1) * C.pts_p,
max_mp_pts = (200-1) * C.pts_m,
ma_pts = (200-1) * C.pts_m,
md_pts = (200-1) * C.pts_m,
max_wt_pts = (200-1) * C.pts_s,
da_pts = (200-1) * C.pts_s,
lk_pts = (200-1) * C.pts_s,
max_hp_pts = (200-1) * C.pts_c,
dp_pts = (200-1) * C.pts_c,
hv_pts = (200-1) * C.pts_c,
attr_pts = (200-1) * 4,
[level] = 200
from char_status as CS
inner join char_attr as C on C.uid = CS.uid
where CS.uid = @char_uid if (@@error <> 0)
begin
set @error = 9003
set @error_msg = 'char_state level update Fail!!'
end
*/
commit tran
--
select C.uid, C.slot, C.[name], C.type, C.type_2, C.f_type, C.job, C.job_2, C.job_state
,C.hair, C.hair_2, C.[money], C.[level], C.tutorial_step, guild_state, is_guild_chief, C.type_3, C.job_3, C.hair_3
from view_char_attr_status_state_equip_all as C
where uid = @char_uid
--
select @slot as slot, item_uid, item_index, item_class, item_pos
from view_item_char as I
where char_uid = @char_uid
and item_where = 0
return 0
ErrorHandling:
if(@@trancount > 0)
rollback tran declare @sp_name varchar(128);
set @sp_name = object_name(@@procid);
if (@error = 1023 or @error = 1019)
begin
select 1 as empty_column where 1 = 0
end
else
begin
RAISERROR('%s (%d)%s : %d, %d, %s, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d', 10, 1, @sp_name, @error, @error_msg,
@owner, @slot, @name, @type, @job, @f_type, @pts_p, @pts_m, @pts_s, @pts_c, @zone, @hair) WITH LOG
end return @error;
这个就是代码 。。