ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
How can I create a plain-text flat file from SQL Server as 
input to another application?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How can I create a plain-text flat file from SQL Server as input to another application?
Answer
# 1
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 ?    1 Yes 0 No
Guest
 
  Re: How can I create a plain-text flat file from SQL Server as input to another application?
Answer
# 2
Use the BCP utility

bcp out Database.dbo.TableName FileName.txt -T -c
 
Is This Answer Correct ?    0 Yes 0 No
Skybeaver
 
 
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
which one will take 1st priority in case of insert statement and select statement???  1
What is a view? is View updatable? IBM11
What is cursor ? And what is difference between Trigger ? HCL1
How to find the date and time of last updated table?  3
How to Check Whether a Global Temporary Exists in a SQL Database or not?  2
Well sometimes sp_reanmedb may not work you know because if some one is using the db it will not accept this command so what do you think you can do in such cases?  2
I have a huge amount of data which is displayed in a report. The data is viewed every day. Every day the data is displayed in 30 secs but suddenly today it is giving an timeout message today. Data has not been changed. The situation is same as yesterday. What might be the reason??? Please Answer. Satyam4
How do you read transaction logs  1
create index a on employee(dno) In this,which index was created?  2
What is the difference between a Local temporary table and a Global temporary table? How is each one used?  1
how to select 5 to 7 rows from a table, which contains 10 rows? IBM14
What is Trigger? Misys2
can any one answer this query,thank you in advance Table 1 has 2 columns: EmployeeId, T shirtsize(values can be 1,2,3) Table 2 has 2 columns: EmployeeId, Region Write SQL to Find the region which has the largest number of people with Tshirt size=3 Google10
What is referential integrity? What are the advantages of it? Digital-Domain3
what is the difference between sql query and google query? TCS7
how to delete duplicate rows from table CSC9
What is ACID Property of Transaction?  4
When do we use the UPDATE_STATISTICS command?  3
What r sql reporting services and analysis services? how can we use it. Microsoft2
How to write stored procedure to update the data in 10 tables  4
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com