error en una procedure de sql

21/07/2004 - 16:24 por ALBERTO | Informe spam
Buenas a tod@s

estoy realizando un programita sobere excel que desde vba me llam a un
procedimiento de sql donde me genera un aoferta con una tabla de cabeceras y
otra de lineas.

Es en esta ultima donde cada vez que ejecuto el procedure me da el
siguiente error:

SE HA PRODUCIDO EL ERROR 4002

37000 [MICROSOFT][ODBC SQL SERVER DRIVER] [SQL SEVER]

ERROR CONVERTING DATA TYPE VARCHAR TO FLOAT



por lo que he mirado la sintaxis es correcta pero si alguien puede echarme
una mano seria estupendo

gracias



CREATE PROCEDURE CreaLinOferta

@codemp as varchar(3),

@codart as varchar(16),

@codoferta as varchar(15),

@codcli as varchar(12),

@fecha as datetime,

@descri as varchar(50),

@canti as float,

@precio as float,

@partida as varchar(20),

@horas as float,

@Observ as varchar(4096),

@NPI as varchar(255)

as

declare @Error as varchar(100), @numlin as int, @nalm as int, @cta as
varchar(15), @tcconCli as varchar(2), @tcconArt as varchar(2),

@norden as int, @umcv as varchar(6), @umpv as varchar(6)

set @Error=''

select * from faoferc where codemp=@codemp and codoferta=@codoferta

if @@rowcount = 0

begin

set @Error= 'No existe una oferta con el código ' + @codoferta

return

end

select @numlin=isnull(max(numlin),0)+1, @norden=isnull(max(norden),0)+5 from
faoferl where codemp=@codemp and codoferta=@codoferta

select @nalm=nalm from param2 where codemp=@codemp

select @cta=isnull(ctaconvent,''), @umcv=codunicven, @umpv=codunipven from
alart where codemp=@codemp and codart=@codart

if @cta=''

begin

select @tcconCli=isnull(tccon,'') from facli where codemp=@codemp and
codcli=@codcli

select @tcconArt=isnull(tccon,'') from alart where codemp=@codemp and
codart=@codart

select @cta=isnull(ctacon,'') from paramconta where codemp=@codemp and
ttcon=@tcconcli and tacon=@tcconart and tccon='VT'

if @cta=''

begin

select @cta=isnull(ctaven,'') from param13 where codemp=@codemp

end

end



INSERT INTO [faoferl]([codemp], [codoferta], [codcli], [numlin], [codart],
[fecentlin], [fecsolic], [descr], [canofer], [canace], [preuni],

[dtoartcli], [implin], [tcomlin], [lintfac], [pmedpon], [totex],

[seriel], [ubicac], [largo], [ancho], [grosor], [numalm], [datvar1],
[datvar2],

[datvar3], [datvar4], [datvar5], [datvar6],

[dto2], [casca2], [dto3], [casca3], [dto4], [casca4], [dto5], [casca5],
[ctaven], [coment],

[genped], [tipoalb], [sefactura], [genkit], [linkit], [genprom], [linprom],
[tcomlin2], [tcomlin3], [tcomlin4], [tcomlin5], [tcomlin6], [salidas],

[npint], [norden], [uniprec], [coddep], [costeped], [impdes], [ndto],
[numcontrato], [rappel], [porprecio], [factcant], [factpre], [tipcont],

[umcv], [umpv])

VALUES(@codemp, @codoferta, @codcli, @numlin, @codart, @fecha, @fecha,
@descri, @canti, @canti, @precio,

0, @precio*@canti, 0, null, null, null,

'', '', 1,1,1,@nalm, '','',

@partida,0,0,0,0,'N',0,'N',0,'N',0,'N',@cta,@observ,

'S','0', 'S', '', 0, '', 0, 0, 0,0,0, 0, 'S',

@NPI, @norden, null, '0', 0, 0, 0, 0, 'S', 100, 1,1,0,

@umcv, @umpv)

GO
 

Leer las respuestas

#1 Ferran Oriol
21/07/2004 - 16:54 | Informe spam
¿La has ejecutado desde el Query Analizer de SQL Server?

f.

"ALBERTO" escribió en el mensaje
news:
Buenas a

estoy realizando un programita sobere excel que desde vba me llam a un
procedimiento de sql donde me genera un aoferta con una tabla de cabeceras


y
otra de lineas.

Es en esta ultima donde cada vez que ejecuto el procedure me da el
siguiente error:

SE HA PRODUCIDO EL ERROR 4002

37000 [MICROSOFT][ODBC SQL SERVER DRIVER] [SQL SEVER]

ERROR CONVERTING DATA TYPE VARCHAR TO FLOAT



por lo que he mirado la sintaxis es correcta pero si alguien puede


echarme
una mano seria estupendo

gracias



CREATE PROCEDURE CreaLinOferta

@codemp as varchar(3),

@codart as varchar(16),

@codoferta as varchar(15),

@codcli as varchar(12),

@fecha as datetime,

@descri as varchar(50),

@canti as float,

@precio as float,

@partida as varchar(20),

@horas as float,

@Observ as varchar(4096),

@NPI as varchar(255)

as

declare @Error as varchar(100), @numlin as int, @nalm as int, @cta as
varchar(15), @tcconCli as varchar(2), @tcconArt as varchar(2),

@norden as int, @umcv as varchar(6), @umpv as varchar(6)

set @Error=''

select * from faoferc where codemp=@codemp and codoferta=@codoferta

if @@rowcount = 0

begin

set @Error= 'No existe una oferta con el código ' + @codoferta

return

end

select @numlin=isnull(max(numlin),0)+1, @norden=isnull(max(norden),0)+5


from
faoferl where codemp=@codemp and codoferta=@codoferta

select @nalm=nalm from param2 where codemp=@codemp

select @cta=isnull(ctaconvent,''), @umcv=codunicven, @umpv=codunipven from
alart where codemp=@codemp and codart=@codart

if @cta=''

begin

select @tcconCli=isnull(tccon,'') from facli where codemp=@codemp and
codcli=@codcli

select @tcconArt=isnull(tccon,'') from alart where codemp=@codemp and
codart=@codart

select @cta=isnull(ctacon,'') from paramconta where codemp=@codemp and
ttcon=@tcconcli and tacon=@tcconart and tccon='VT'

if @cta=''

begin

select @cta=isnull(ctaven,'') from param13 where codemp=@codemp

end

end



INSERT INTO [faoferl]([codemp], [codoferta], [codcli], [numlin], [codart],
[fecentlin], [fecsolic], [descr], [canofer], [canace], [preuni],

[dtoartcli], [implin], [tcomlin], [lintfac], [pmedpon], [totex],

[seriel], [ubicac], [largo], [ancho], [grosor], [numalm], [datvar1],
[datvar2],

[datvar3], [datvar4], [datvar5], [datvar6],

[dto2], [casca2], [dto3], [casca3], [dto4], [casca4], [dto5], [casca5],
[ctaven], [coment],

[genped], [tipoalb], [sefactura], [genkit], [linkit], [genprom],


[linprom],
[tcomlin2], [tcomlin3], [tcomlin4], [tcomlin5], [tcomlin6], [salidas],

[npint], [norden], [uniprec], [coddep], [costeped], [impdes], [ndto],
[numcontrato], [rappel], [porprecio], [factcant], [factpre], [tipcont],

[umcv], [umpv])

VALUES(@codemp, @codoferta, @codcli, @numlin, @codart, @fecha, @fecha,
@descri, @canti, @canti, @precio,

0, @precio*@canti, 0, null, null, null,

'', '', 1,1,1,@nalm, '','',

@partida,0,0,0,0,'N',0,'N',0,'N',0,'N',@cta,@observ,

'S','0', 'S', '', 0, '', 0, 0, 0,0,0, 0, 'S',

@NPI, @norden, null, '0', 0, 0, 0, 0, 'S', 100, 1,1,0,

@umcv, @umpv)

GO


Preguntas similares