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

How to convert numeric expression data types using the cast() function?

0 Answers  


Is profiler the only tool that has the ability to audit and identify ddl events? : sql server security

0 Answers  


how many bits ip address consist of? : Sql server database administration

0 Answers  


What is openrowset sql server?

0 Answers  


State a few properties of relational databases?

0 Answers  


What type of locking occurs during the snapshot generation? : sql server replication

0 Answers  


Explain what are db_options used for?

1 Answers   InterGraph,


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?

0 Answers  


can you any body tell me simple recovery,full recovery,bulk logged recovery where can use?

1 Answers  


SQL Server Architecture ?

0 Answers   IBM, Sapient,


Tell me what is use of except clause? How it differs from not in clause?

0 Answers  


Categories