[Show all top banners]

Kalopoolbasi
Replies to this thread:

More by Kalopoolbasi
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 Question to Chintamani and other SQL experts
[VIEWED 4507 TIMES]
SAVE! for ease of future access.
Posted on 08-10-08 11:56 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 Hi guys,

I am supposed to copy the result of a query into a flat file. After looking at your problem/solution, I tried the following:

 

Bcp Select.....From....Where..... out "c:\abc.txt" -c -T

Then I got the error:

Msg 102, Level 15, State 1, Line 12

Incorrect syntax near 'out'.

How should I get it to work?

Thanks


 
Posted on 08-10-08 1:10 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

You can use Export/Wizard instead.


 
Posted on 08-15-08 3:10 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

try this syntax:

 

bcp "select * from whatever" queryout c:\authors.txt -c -T

basically i think you need the quotes around your query and not your export file... let me know if that helped


 
Posted on 08-15-08 3:10 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

try this syntax:

 

bcp "select * from whatever" queryout c:\authors.txt -c -T

basically i think you need the quotes around your query and not your export file... let me know if that helped


 
Posted on 08-15-08 3:45 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Thank you. i will try that.
 
Posted on 08-15-08 4:05 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I am copying my query result into a temp table and trying to write the contents of the temp table into a flat file..

When I do:

BCP "#temp_NS_events" queryout c:\abc.txt -c -T

I get the error:

Incorrect syntax error near 'BCP'


 
Posted on 08-15-08 4:56 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

if you just need to export query result in to text file then just run query as result to file

Query->Result to->reuslt to file

all the best ,

have good weekend


 
Posted on 08-15-08 6:01 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

use tempdb

create table playertemp

( playerID varchar(25),

playerFname varchar(25),

playerLname varchar(25),

email varchar(25))

 

insert into playertemp

select * from test.dbo.player  //just use your query over here

 

and then

bcp tempdb.dbo.playertemp out "c:\playertemp.txt" -c -T -SKalopoolbasi

note Kalopoolbasi is the server name

This should work.

 

 

 


 
Posted on 08-16-08 5:38 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Thanks Chintamani...I will let you know how it went after I try this.

Thank you very much.


 
Posted on 08-17-08 12:23 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Why do you have to put  the results in Temp table taking TEMPDB resources. Remember SQL server 2005 uses lot of TempDB resources than SQL 2000. Just use Export/Import wizard and schedule it if you like to.


 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 365 days
Recommended Popular Threads Controvertial Threads
Lets play Antakshari...........
डीभी परेन भने खुसि हुनु होस् ! अमेरिकामाधेरै का श्रीमती अर्कैसँग पोइला गएका छन् !
शीर्षक जे पनि हुन सक्छ।
What are your first memories of when Nepal Television Began?
[New post] Why Would Krishna Have To Run From The Battlefield
Sajha Poll: नेपालका सबैभन्दा आकर्षक महिला को हुन्?
ChatSansar.com Naya Nepal Chat
is Rato Bangala school cheating?
Why always Miss Nepal winner is Newari??
NRN card pros and cons?
Basnet or Basnyat ??
पुलिसनी संग - आज शनिवार - अन्तिम भाग
निगुरो थाहा छ ??
Nas and The Bokas: Coming to a Night Club near you
श्राद्द
TPS Re-registration
सेक्सी कविता - पार्ट २
What Happened to Dual Citizenship Bill
पाप न साप घोप्टो पारि थाप !!
अमेरिकामा छोरा हराएको सूचना
Nas and The Bokas: Coming to a Night Club near you
राजदरबार हत्या काण्ड बारे....
Mr. Dipak Gyawali-ji Talk is Cheap. US sends $ 200 million to Nepal every year.
Harvard Nepali Students Association Blame Israel for hamas terrorist attacks
TPS Update : Jajarkot earthquake
is Rato Bangala school cheating?
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters