PDA

View Full Version : Manor procedures


rodier
03.01.2007, 13:45
hi all
it is normal if players must set manor every day?
First time I think yes..but now I see sometimes in cacheD some errors with procedure lin save ..last manor.. something like that..
problems with converting varchar to datetime..

I tried to edit manor table and save manor procedures and changed datetime to varchar.. but still get some errors..

Can anyone post here your manor procedures?


01/02/2007 06:00:xx.xx4, Error sql: EXEC lin_SetLastTaxUpdate '2007-0-1 12:0:52', '2007-0-2 0:0:4', '2007-0-2 6:0:8' (0)
01/02/2007 06:00:xx.xx4, Error sql: exec lin_SaveManorInfo 7, 7, 0, 0, 1, '0-0-0 0:0:0' (0)
01/02/2007 06:00:xx.xx4, Error 42000:[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to datetime.
01/02/2007 06:00:xx.xx4, Error 42000:[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to datetime.
01/02/2007 06:00:xx.xx4, [.\Socket.cpp][12448] cannot update last tax change date.
01/02/2007 06:00:xx.xx4, [.\ManorDb.cpp][207]Cannot Save manor info, [7]-[7][0][0]


SetLastTaxUpdate:

ALTER PROCEDURE [dbo].[lin_SetLastTaxUpdate]
(
@income varchar,
@tax varchar,
@manor varchar

I changed it from datetime to varchar.. It seems to bad.. but I get "vice versa" error earlier (Error converting data type datetime to varchar.) .. so I changed it to varchar..

SaveManorInfo

@last_changed varchar

FidoW
03.01.2007, 16:54
Umm, im not sure, a lot of time since i fixed that.. but the fix was converting input values in the store procedure to a valid datetime format... or something like that

rodier
03.01.2007, 21:05
can u show me your stored procedures?

kin
07.01.2007, 12:15
FidoW
Can you share your fix please. I'm facing the same problem

mono
17.01.2007, 09:05
ALTER PROCEDURE dbo.lin_SetLastTaxUpdate
(
@income varchar(100),
@tax varchar(100),
@manor varchar(100)
)
AS

declare @income_ datetime
declare @tax_ datetime
declare @manor_ datetime

set @income =left(@income,5) + cast((cast(replace(substring(@income,6,2),'-','') as int) + 1) as varchar) + substring(@income, charindex ('-', @income, 6),100)
set @tax =left(@tax,5) + cast((cast(replace(substring(@tax,6,2),'-','') as int) + 1) as varchar) + substring(@tax, charindex ('-', @tax, 6),100)
set @manor =left(@manor,5) + cast((cast(replace(substring(@manor,6,2),'-','') as int) + 1) as varchar) + substring(@tax, charindex ('-', @tax, 6),100)

set @income_ = convert(datetime, @income)
set @tax_ = convert(datetime, @tax)
set @manor_ = convert(datetime, @manor)


SET NOCOUNT ON
IF EXISTS(SELECT * FROM castle_tax)
BEGIN
UPDATE castle_tax SET income_update = @income_, tax_change = @tax_, manor_reset = @manor_
END
ELSE
BEGIN
INSERT INTO castle_tax VALUES
( @income_, @tax_, @manor_)

END

mcrabben7
17.01.2007, 09:35
Thanks for the fix. It's useful (and amazingly simple) =)

Rexx
17.01.2007, 10:50
Thanks for the fix,
I have been working on this error for several weeks with no results.

KOC2000
30.01.2007, 00:10
Thank you so much.