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 spatial nonclustered index

0 Answers  


Can we delete data from a view?

0 Answers  


How do I install only the client tools of sql server 2000?

0 Answers  


What is the use of floor function in sql server?

0 Answers  


What is user-defined function?

0 Answers  


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

2 Answers   CSC,


What is a filestream?

0 Answers  


what is cursor?why we will go to cursor?advantages &disadvantages of cursors?

1 Answers  


How to declare and use cursor variables?

0 Answers  


Do you know what is raid and what are different types of raid configurations? : SQL Server Architecture

0 Answers  


What does ss stand for sexually?

0 Answers  


What is NOT NULL Constraint in sql server 2012?

0 Answers   CDC,


Categories