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 is the maximum size of a row in sql server?
What are functions in the sql server?
How data can be copied from one table to another table?
Determine how to use the inserted and deleted pseudo tables?
How do you persist objects, permissions in tempdb
What is the distinction amongst delete and truncate?
what is differece between union and union all
What are the steps need to be take improve the speed of a SQLDATA Server?
Write a query to include a constraint, to check whether the employee salary is greater than 5000?
Can you explain various data region available in ssrs with their use?
optimization techinques
Do you know how to store and query spatial data?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)