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 difference between equi join and inner join?
What are the types of containers in ssis?
What is dirty read?
Explain what are the different index configurations a table can have?
Please explain that what are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture
What do you mean by subquery?
What are the restraints imposed on the table design by a merge replication?
can i write function in stored procedure and stored procedure in function and nested procedure.Give one example for each question?
Explain indexed view?
What does it mean if @@cursor_row returns a negative number?
Does order by actually change the order of the data in the tables or does it just change the output?
Explain difference between cross join and full outer join?
Oracle (3253)
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)