XP_CMDSHELL
Publicado por miguel (10 intervenciones) el 06/08/2007 18:45:57
declare @Sepa nvarchar(4)
, @Ruta nvarchar(2000)
, @Archivo nvarchar(2000)
select @Ruta = 'C:\'
select @Archivo = 'PlanillaB.txt'
select @Archivo = 'bcp "select getdate()" queryout ' + @Ruta + @Archivo + ' -S -U -P -c'
exec master..xp_cmdshell @Archivo--, no_output
select @Archivo
mi intencion es grabar un archivo, primero paso a paso al hacer este como ejemplo obtengo el sgte error:
SQLState = 28000, NativeError = 18452
Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user ''. The user is not associated with a trusted SQL Server connection.
NULL
el select @Archivo resulta:
bcp "select getdate()" queryout C:\PlanillaB.txt -S -U -P -c
ya tengo habilitado el xp_cmdshell en surface configuration
estoy trabajando como sql server y windows autentification.
SQL Server 2005
, @Ruta nvarchar(2000)
, @Archivo nvarchar(2000)
select @Ruta = 'C:\'
select @Archivo = 'PlanillaB.txt'
select @Archivo = 'bcp "select getdate()" queryout ' + @Ruta + @Archivo + ' -S -U -P -c'
exec master..xp_cmdshell @Archivo--, no_output
select @Archivo
mi intencion es grabar un archivo, primero paso a paso al hacer este como ejemplo obtengo el sgte error:
SQLState = 28000, NativeError = 18452
Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user ''. The user is not associated with a trusted SQL Server connection.
NULL
el select @Archivo resulta:
bcp "select getdate()" queryout C:\PlanillaB.txt -S -U -P -c
ya tengo habilitado el xp_cmdshell en surface configuration
estoy trabajando como sql server y windows autentification.
SQL Server 2005
Valora esta pregunta


0