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 |
How to convert numeric expression data types using the cast() function?
Is profiler the only tool that has the ability to audit and identify ddl events? : sql server security
how many bits ip address consist of? : Sql server database administration
What is openrowset sql server?
State a few properties of relational databases?
What type of locking occurs during the snapshot generation? : sql server replication
Explain what are db_options used for?
What is the difference between Temporary table variable and a Table variable? Or Which Table variable I should use inside Stored procedure?
3 Answers Microsoft, TCS, Techastrum,
Explain what are the basic functions for master, msdb, model, tempdb databases?
can you any body tell me simple recovery,full recovery,bulk logged recovery where can use?
SQL Server Architecture ?
Tell me what is use of except clause? How it differs from not in clause?
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)