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...

How can I create a plain-text flat file from SQL Server as
input to another application?

Answer Posted / guest

A. One of the purposes of Extensible Markup Language (XML)
is to solve challenges like this, but until all
applications become XML-enabled, consider using our faithful
standby, the bulk copy program (bcp) utility.
This utility can do more than just dump a table; bcp also
can take its input from a view instead of from a table.
After you specify a view as the input source, you can limit
the output to a subset of columns or to a subset of rows by
selecting appropriate filtering (WHERE and HAVING) clauses.

More important, by using a view, you can export data from
multiple joined tables. The only thing you cannot do is
specify the sequence in which the rows are written to the
flat file, because a view does not let you include an ORDER
BY clause in it unless you also use the TOP keyword.

If you want to generate the data in a particular sequence or
if you cannot predict the content of the data you want to
export, be aware that in addition to a view, bcp also
supports using an actual query. The only "gotcha" about
using a query instead of a table or view is that you must
specify queryout in place of out in the bcp command line.

For example, you can use bcp to generate from the pubs
database a list of authors who reside in California by
writing the following code:

bcp "SELECT * FROM pubs..authors WHERE state = 'CA'"
queryout c:\CAauthors.txt -c -T -S

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1261


How can you control the amount of free space in your index pages?

1008


Is it possible in sql table to have more than one foreign key?

975


As a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this?

988


List out the different types of locks available in sql server?

931


Explain the categories of stored procedure?

885


How much is a sql server license?

899


Name few endpoints exposed by ssrs 2012?

343


How do I find the sql server instance name?

914


how you can deploy an ssrs report?

172


What is difference between equi join and natural join?

963


Explain what is cte (common table expression)?

1062


List layers of abstraction microsoft architectured to provide relational db through cloud platform ?

181


When setting replication, is it possible to have a publisher as 64 bit sql server and distributor or subscribers as a 32 bit sql server?

892


How do I change my passwords (database, LDAP, and so on) without causing an outage?

1014