hi,
open sql query analyzer
click on "query"
click on "results to file"
run a query.
or better yet
run BCPor the bulk copy program
regards,
joey
|||
This will work if xp_cmdshell is enabled
DECLARE @.isqlString varchar(255)
SELECT @.isqlString = 'isql -Q "SELECT top 10 FROM TABLE" -E -o C:\Results.txt'
EXEC master..xp_cmdshell @.isqlString
|||Hi,
I found Steve's tip very helpful, however I also found out that you have to refer to the database name that the table belongs to even if the database you are refering to is the currently selected database within query analyser. This is because the command shell cannot see what the default database within query analyser is.
Please find the following example; -
declare @.str varchar(255)
select @.str = 'isql -Q"select * from spintlslive.dbo.T_Payments WHERE Paydate = ''07/13/2007''" -E -w255 -oD:\UPLOADS\payments.txt'
exec master..xp_cmdshell @.str
No comments:
Post a Comment