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

What happens if you are trying to access a schema not owned by you?

1020


What happens if you insert a duplicate key for the primary key column in ms sql server?

1023


What is dbcc?

1179


Give me any three differences between Truncate and Delete.

1154


Can multiple columns be used in sql group by clause in ms sql server?

1114


How to rename databases in ms sql server?

1253


Why de-normalization required?

1053


you want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition? : Sql server administration

1154


What are the different types of replication you can set up in sql server?

1086


When columns are added to existing tables, what do they initially contain?

1093


What is sql stored procedure?

1145


What is the default port for SQL Server over a firewall?

1141


To automatically record the time on which the data was modified in a table, which data type should you choose for the column?

1002


Differentiate between a having clause and a where clause.

1007


Tell me in brief how sql server enhances scalability of the database system?

1038