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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we insert data if clustered index is disabled?

943


Does partitioning improve performance?

979


what are the different ways of moving data/databases between servers and databases in sql server? : Sql server database administration

985


What are the limitations in ssrs on sql server express edition?

186


Explain the difference between control flow and data flow?

997


Explain logical operators in sql server?

1110


What is normalization? What number of normalization shapes are there?

1109


What is temporary table in sql server? Why we use temp table?

953


What do you understand by replication in sql server? Mention the different types of replication in sql server.

947


What is query processing?

942


Can you move the resources after pausing the node? : sql server database administration

1108


What are the character string functions supported by sql server 2005?

1014


What is a deadlock and what is a live lock?

1003


How many instances per computer are there in sql server 2000?

1078


What is the difference between osql and query analyzer?

997