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 |
Explain magic tables in sql server?
What is standby servers? Explain types of standby servers.
What is mssql?
What is ms sql server triggers?
How fixed length strings are truncated and padded?
Explain sql server authentication modes?
When is the use of update_statistics command?
How do I shrink an ldf file?
What is the cartesian product of the table?
Explain features of analysis services?
What is surrogate key? : sql server analysis services, ssas
What is always encrypted?