|
Daniel12477
Starting Member
1 Post |
Posted - 2011-08-12 : 10:41:30
|
| Hi I am getting an error with my stored procedure wich must send an sms to a telephone number,i am using ozeki as sms gateway.The problem is that when i execute the stored procedure it says that <<The conversion of the nvarchar value '+250722123148' overflowed an int column.Maximum integer value exceeded.>>Pliz can anyone help.Thanx!! the procedure is made lik this: CREATE PROC [dbo].[transfertcash](@numb nvarchar(50),@montant float,@numtel nvarchar(50),@code nvarchar(50),@msg_to_send as nvarchar(4000) output)ASbegin --1declare @num nvarchar(50)declare @balance as floatdeclare @statusC nvarchar(50)declare @imsi nvarchar(50)declare @diff as floatdeclare @nom nvarchar(50)declare @prenom nvarchar(50)declare @idtrans as intdeclare @etat nvarchar(50)declare @taux as floatset @nom=(select nom from dbo.mylogin1 where numtel='+250722123148')set @prenom=(select prenom from dbo.mylogin1 where numtel='+250722123148')set @statusC = (select etat from McellAcc where numtel = '+250722123148')if @statusC = 'opened'begin --2 set @num = (select numtel from McellAcc where numtel ='+250722123148') if @num > 0 --numtel found begin --3 set @balance =( select solde from McellAcc where numtel ='+250722123148') set @diff = @balance - @montant if @diff < 0 begin --4--compare amounts set @msg_to_send = 'Insufficiant balance, impossible to transfer e-cash!' end --4 else --if diff>0 begin --5 if @montant > = '10000' and @montant < = '100000' begin --6 insert into TransactionM( numtel, debitmonta, creditmonta, DateTrans, taux, etat ) values( @numtel, @montant, 0, getdate(), @taux, @etat ) UPDATE McellAcc set solde = solde - @montant where numtel=@numtel UPDATE TransactionM set etat= 'Pending...' where idtrans=(SELECT idtrans from TransactionM where numtel=@numtel) set @msg_to_send = 'You received '+ cast(@montant as varchar(50)) + ' from ' + @nom+','+@prenom+','+@num +','+ cast(@idtrans as nvarchar(50)); insert into ozekimessageout(receiver,msg,status) values (@numb,@msg_to_send,'send') end--6 else begin --6 set @msg_to_send = 'You are sending less or more than allowed!' end --6 end --5 endend else begin --2--status fermé set @msg_to_send='Transaction failed,try again!'end --1 end------------------------------------------------------------------I am using the following tables :create table MyLogin1(id int identity not null primary key nonclustered, numtel nvarchar(50)constraint fkidc foreign key references dbo.McellAcc(numtel),nom nvarchar(50)not null,prenom nvarchar(50) not null,idsession nvarchar(50)not null);create table TransactionM(idtrans int identity not null primary key nonclustered,numtel nvarchar(50)constraint fknu foreign key references dbo.McellAcc(numtel),debitmonta nvarchar(50) null,creditmonta nvarchar(50) null,datetrans datetime not null,taux float,etat nvarchar(50)null);create table McellAcc(numtel nvarchar(50)constraint pknumt primary key nonclustered,idcarte nvarchar(50)constraint fkidca foreign key references dbo.Client(idcarte),imsi nvarchar(50) unique not null,dateouv datetime not null,solde nvarchar(50) null,etat nvarchar(50)not null,motif nvarchar(50) not null);create table ozekimessageout(id int identity(1,1),sender nvarchar(50),receiver nvarchar(50),msg nvarchar(50),senttime nvarchar(50),receivedtime nvarchar(50),operator nvarchar(50),msgtype nvarchar(50),reference nvarchar(50),statu nvarchar(50),errormsg nvarchar(50));muhirwa |
|