Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?



Is it possible to create a stored procedure that runs a query and outputs the results to a text fi..

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

Post New Answer

More SQL Server Interview Questions

What is the use of keyword with encryption.

0 Answers  


How to connect PK and FK?

2 Answers  


What is the basic functions for master, msdb, tempdb databases?

2 Answers   CSC,


What are different types of database indexes?

0 Answers  


What is the difference between stored procedure and functions?

0 Answers   MCN Solutions,


Do you know what are the ways available in sql server to execute sql statements?

0 Answers  


What is the difference between ‘having’ clause and a ‘where’ clause?

0 Answers  


What is set nocount on?

0 Answers  


How to Insert multiple rows with a single insert statement?

0 Answers  


How to create a new login name in ms sql server?

0 Answers  


What are the difference between “where” and “having” clause in sql server?

0 Answers  


When would you use sql joins?

0 Answers  


Categories