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
 output file

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-03 : 14:58:05
Hi can any one helpme out to store the output of the below query
in a local machine,without using xp_cmdshell

Declare @objectName varchar(1000),@Command NVARCHAR(500)
set @objectName='dt_droppropertiesbyid'
SET @Command = 'sp_helptext [' + @objectName + '] '
Exec (@Command)
--output will be the definition of stored procedures

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-04 : 01:59:21
you can choose result to file option from query->results to on top menu

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

Go to Top of Page

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-04 : 09:34:28
How this can be done through T-Sql statement
quote:
Originally posted by visakh16

you can choose result to file option from query->results to on top menu

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



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-04 : 09:35:38
you need to use bcp then

------------------------------------------------------------------------------------------------------
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:00:08
i tried like this
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
but i dont want to use xp_cmdshell

quote:
Originally posted by visakh16

you need to use bcp then

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



Go to Top of Page
   

- Advertisement -