Ya lo he intentado así:
Código SQL:
Ver originalEXEC Master..xp_cmdshell 'bcp "select * from #CyberPuertaPrecio" queryout "C:\Documents and Settings\tlemus\Escritorio\a.csv" -U sa -P interconexion -c'
Y también así:
Código SQL:
Ver originalEXEC Master..xp_cmdshell 'bcp "select PreciosCyberPuerta.Clave as NoArtMayorista, PreciosCyberPuerta.NoParte as NoArtFabricante,PreciosCyberPuerta.Descripcion as NombreProducto, PreciosCyberPuerta.Descripcion2 as DescripProducto,PreciosCyberPuerta.Modelo as MarcaProducto, PreciosCyberPuerta.Precio2 as PrecioVenta,PreciosCyberPuerta.Moneda as Moneda,sum(t1.existencia-t2.ordenado) as DisponibilidadTotal, sum(PreciosCyberPuerta.Mnty-PreciosCyberPuerta.OrdMnty) as DispMty,sum(PreciosCyberPuerta.Gdl-PreciosCyberPuerta.OrdGdl) as DispGdl,sum(PreciosCyberPuerta.Mexico-PreciosCyberPuerta.OrdMex) as DispMexfrom (select clave , sum (mnty+gdl+mexico) as existencia from #CyberPuertaPrecio group by clave) as T1 , (select clave, sum (OrdMnty+OrdGdl+OrdMex) as ordenado from #CyberPuertaPrecio group by clave) as T2 , #CyberPuertaPrecio as PreciosCyberPuerta where t1.clave=t2.clave and PreciosCyberPuerta.clave=t1.clave and t2.clavE=PreciosCyberPuerta.clave group by PreciosCyberPuerta.Clave, PreciosCyberPuerta.NoParte, PreciosCyberPuerta.Descripcion, PreciosCyberPuerta.Descripcion2, PreciosCyberPuerta.Modelo, PreciosCyberPuerta.Precio2, PreciosCyberPuerta.Moneda" queryout "C:\Documents and Settings\tlemus\Escritorio\a.csv" -U sa -P interconexion -c'
Pero cualquiera de las dos formas marca este error.
Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.
Ya intente ejecutar...
Código SQL:
Ver originalsp_configure 'Web Assistant Procedures', 1;
GO
RECONFIGURE
GO
El resultado :
Msg 15123, Level 16, State 1, Procedure sp_configure, Line 51
The configuration option 'Web Assistant Procedures' does not exist, or it may be an advanced option.