Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 without xp_cmdshell

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-04 : 09:59:20
[code]
DECLARE @cmd VARCHAR(2048)

SET @cmd = 'bcp "EXEC pubs..reptq1" queryout'
+' "c:\query.txt" -c -Usa -Ppassword'
+' -SLOCALHOST"'

EXEC master..xp_cmdshell @cmd, NO_OUTPUT
[/code]
can any one say how to execute command without XP_cmdshell

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-04 : 10:00:09
you cant execute bcp without using xp_cmdshell in t-sql

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-04 : 10:01:33
some think like this

DECLARE @cmd VARCHAR(2048)

SET @cmd = 'bcp "EXEC pubs..reptq1" queryout'
+' "c:\query.txt" -c -Usa -Ppassword'
+' -SLOCALHOST"'


exec (@cmd))


quote:
Originally posted by visakh16

you cant execute bcp without using xp_cmdshell in t-sql

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-03-04 : 11:08:39
some think wrong. BCP is a command line utility, not a T-SQL one
Go to Top of Page

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-04 : 11:18:38
ok..then how to do this without xp_cmdshell
quote:
Originally posted by russell

some think wrong. BCP is a command line utility, not a T-SQL one

Go to Top of Page
   

- Advertisement -