Is it possible to create a stored procedure that runs a
query and outputs the results to a text file and allows me
to add extra delimeters and static field info. If so How?
Answer / guest
SQL Server has no native command for outputting query
results to a file. You can use the extended
stored procedure xp_cmdshell and call isql (command-line
SQL) with your query and output the results to a file. Any
delimiters would need to be part of the SELECT string:
DECLARE @isqlString varchar(255)
SELECT @isqlString = 'isql -Q "SELECT DateCol FROM
NorthwindTest.dbo.Test" -E -o C:\Results.txt'
EXEC master..xp_cmdshell @isqlString
Is This Answer Correct ? | 0 Yes | 0 No |
What are indexers?
What are the basic functions for master, msdb, model, tempdb and resource databases?
How to connect php with different port numbers?
user defined datatypes
What is data integrity? Explain constraints?
What are the different types of sub-queries?
Can you insert NULL in unique column?
Explain different types of lock modes in sql server 2000?
How to get @@error and @@rowcount at the same time?
What do you mean by recursive stored procedure?
How do you fine the performance tunning?
What are the new features in SQL Server 2005?