•         

            

            

  • HyperFilter | DoS Protection | DDoS Protection | DoS Mitigation | DDoS Mitigation | AntiDoS | AntiDDoS | Proxy Shielding

SQL 2012 itemleri_encode Procedure hatası yardım

Katılım
25 Aralık 2013
Mesajlar
2,676
Msg 402, Level 16, State 1, Procedure itemleri_encode, Line 75

The data types varbinary and varchar are incompatible in the add operator.



bu hatayı veriyor nasıl düzeltilebilir.

sql 2008 uyumlu itemleri_encode aşağıdakini uygulayınca yukarıdaki hatayı veriyor. Daha hiç biryerde paylaşılmamış. Burada paylaşılırsa çok güzel olur düşüncesindyim..



if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ITEMLERI_ENCODE]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)

drop procedure [dbo].[ITEMLERI_ENCODE]

GO



SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO



CREATE procedure itemleri_encode

@StrUserID varchar(30)

AS

DECLARE

@length int, -- stritem uzunluğu

@row int, -- yerine göre deişior.

@i int, -- item'in stritem deki yeri

@dwid int, -- dwid

@pos int,

@dur int,

@dur1 int,

@ext int,

@StackSize1 int,

@strName varchar(30),

@strExtName varchar(30),

@Cdwid varbinary(4),

@cdur varchar(2),

@Source tinyint,

@NEWdwid int,

@StackSize int,

@cstack varchar(2),

@sira int



set @sira=0

set @i = 14*0

set @length = 601



select @row=count( * ) from userdata where struserid=@StrUserID



if @row>0

begin





Select @dwid=dwid,

@dur = durability,

@StackSize1 = stacksize,

@StrUserID = strUserID

From itemler

Where strUserID = @StrUserID and sira=@sira



Set @Cdwid = Substring(cast(@dwid as varbinary(4)), 4, 1) + Substring(cast(@dwid as varbinary(4)), 3, 1) +

Substring(cast(@dwid as varbinary(4)), 2, 1) + Substring(cast(@dwid as varbinary(4)), 1, 1)

Set @Cdur = cast(Substring(cast(@dur as varbinary(2)), 2, 1)+Substring(cast(@dur as varbinary(2)), 1, 1) as

varchar(2))

Set @Cstack = cast(Substring(cast(@StackSize1 as varbinary(2)), 2, 1)+Substring(cast(@StackSize1 as

varbinary(2)), 1, 1) as varchar(2))





update UserData set strItem = cast(cast(cast(@Cdwid as varchar(4)) + @Cdur + @Cstack as varchar(8)) as

binary(600)) where strUserID = @strUserID





set @i=@i+8

set @sira=@sira+1





WHILE @sira < 50

Begin



Select @dwid=dwid,

@dur = durability,

@StackSize1 = stacksize,

@StrUserID = strUserID

From itemler

Where strUserID = @StrUserID and sira=@sira



Set @Cdwid = Substring(cast(@dwid as varbinary(4)), 4, 1) + Substring(cast(@dwid as varbinary(4)), 3, 1) +

Substring(cast(@dwid as varbinary(4)), 2, 1) + Substring(cast(@dwid as varbinary(4)), 1, 1)

Set @Cdur = cast(Substring(cast(@dur as varbinary(2)), 2, 1)+Substring(cast(@dur as varbinary(2)), 1, 1) as

varchar(2))

Set @Cstack = cast(Substring(cast(@StackSize1 as varbinary(2)), 2, 1)+Substring(cast(@StackSize1 as

varbinary(2)), 1, 1) as varchar(2))





update UserData set strItem = cast( substring(strItem, 1, @i) + cast(cast(@Cdwid as varchar(4)) + @Cdur +

@Cstack as varchar(8)) + substring(strItem, @i+8, 601-@i) as binary(600)) where strUserID = @strUserID





set @i=@i+8

set @sira=@sira+1



end

end

delete from itemler

GO

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO
 
Cevap: SQL 2012 itemleri_encode Procedure hatası yardım



Msg 402, Level 16, State 1, Procedure itemleri_encode, Line 76

The data types varbinary and varchar are incompatible in the add operator.



hatası alıyorum hocam bunu yazınca
 
Geri
Üst