Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   SetLastTaxUpdate (https://postpacific.loc-online.com/showthread.php?t=6589)

Firefly 14.01.2007 06:12

SetLastTaxUpdate
 
Error sql: EXEC lin_SetLastTaxUpdate '2007-0-2 12:0:57', '2007-0-2 0:0:54', '2007-0-2 20:0:2' (0)
Error 42000:[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to datetime.
[.\Socket.cpp][12448] cannot update last tax change date.


Народ некто не сталкивался с такой ошибкой в [Cachede]

/en/ Plz help to correct this mistake, has already bothered

sys[antaris] 14.01.2007 07:20

Обрати внимание на месяц, он нулевой, добавляй в процедуре +1 к месяцу и все будет нормально.

SnowDragon 14.01.2007 09:56

может подскажите как? =) а то в скуле не силен...
или сцылочку на какую-нибудь статейку по этой теме =)))

mono 14.01.2007 11:31

чтото типа такого, не тестил...
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


All times are GMT. The time now is 15:25.