
11/03/2008, 11:08
|
| | Fecha de Ingreso: febrero-2008
Mensajes: 15
Antigüedad: 17 años Puntos: 0 | |
Re: Duda Procedimiento OK; entonces la situacion es que no se pueden ocupar funciones en dentro de la sentencia CASE? por que tengo mi case de esta manera pero me sigue mandando el error: [Microsoft][ODBC SQL Server Driver]Campo COUNT erróneo o error de sintaxis
declare @anio varchar (5)
declare @sql nvarchar (1000)
set @mes = datepart ("m",?)
set @anio = datepart ("yyyy",?)
set @sql = 'insert into A4E_CuentaContable (reporteperiodo_id,concepto,
montomn,montome,montototal) select b.reporteperiodo_id,a.cuenta as concepto,b.montomn,b.montoME, ' + @mes + ' from tmp_a4e_cuentascontablesab a
inner join tmp_a4e_cuentacontable b on a.cuenta=b.concepto where anio =' + @anio + 'order by a.cuenta'
case @mes when datepart ("m",?)=1 then 'Enero'
when datepart ("m",?)=2 then 'Febrero'
when datepart ("m",?)=3 then 'Marzo'
when datepart ("m",?)=4 then 'Abril'
when datepart ("m",?)=5 then 'Mayo'
when datepart ("m",?)=6 then 'Junio'
when datepart ("m",?)=7 then 'Julio'
when datepart ("m",?)=8 then 'Agosto'
when datepart ("m",?)=9 then 'Septiembre'
when datepart ("m",?)=10 then 'Octubre'
when datepart ("m",?)=11 then 'Noviembre'
when datepart ("m",?)=12 then 'Diciembre'
else @mes
execute sp_executesql @sql |