473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

sql server -- result wants into txt file or exel file

hi all

i want sql query result into text file (by using query) can any one tell me...

like this Select * from employee where empname='sachin' to 'c:\result.txt'

from sachin shah
Aug 9 '07 #1
4 2918
hi all

i want sql query result into text file (by using query) can any one tell me...

like this Select * from employee where empname='sachin' to 'c:\result.txt'

from sachin shah
You should be able to set 'Results to File' in Query Analyzer. To do this in Query Analyzer click Query->Results to File, or press Ctrl+Shift+T.

Then when you execute your query, it will go to a file of your choosing.

The other way is to simply copy and paste the results grid to Excel.

What version of SQL are you running? Are you trying to do this once or twice or are you trying to write a program that does this?
Aug 10 '07 #2
You should be able to set 'Results to File' in Query Analyzer. To do this in Query Analyzer click Query->Results to File, or press Ctrl+Shift+T.

Then when you execute your query, it will go to a file of your choosing.

The other way is to simply copy and paste the results grid to Excel.

What version of SQL are you running? Are you trying to do this once or twice or are you trying to write a program that does this?
hi

i know these thing, but i want the query....

i am using sql 2000...
Aug 14 '07 #3
azimmer
200 Expert 100+
hi

i know these thing, but i want the query....

i am using sql 2000...
unfortunately it isn't that easy; in fact a simple query can hardly do it

one way to go is to build a DTS package (if you start from Enterprise Manager / Data Transformation Services, it is fairly straightforward, though not necessarily simple)

another possibility is to do it the other way round: via ODBC from Excel (it doesn't work for TXT)
Aug 14 '07 #4
azimmer
200 Expert 100+
unfortunately it isn't that easy; in fact a simple query can hardly do it

one way to go is to build a DTS package (if you start from Enterprise Manager / Data Transformation Services, it is fairly straightforward, though not necessarily simple)

another possibility is to do it the other way round: via ODBC from Excel (it doesn't work for TXT)
oh yea', and one more, maybe the best fit to your needs: OPENROWSET
Aug 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
19
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2...
1
by: Tom | last post by:
> > Ciao a tutto il NG. > > Access 97 > > Devo poter inserire un record vuoto in una maschera a schede continua > cioè. > > record 1 > > record 2 > > record 3 > > record 4 > > record 5 > >...
2
by: Sylvain GENTIN | last post by:
Hi I try to bring back to exel a string computed by VB macro function. --------------------------------------------------------- Function CameoFilter(FileName As String, ByRef TextLine As...
10
by: Niyazi | last post by:
Hi, I developed an application and I am using SQL Server 2000 developer edition. I create my database and I have also created tbl_USER table. I have an ID, RealName, UserName, and UserPassword...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
4
by: thebjorn | last post by:
I'm working with a MS SQL Server database created by a program from a fine US company who seems to have gotten run over by the Unicode truck. In their infinite wisdom they've decided to store...
1
by: Adem24 | last post by:
How would one program a sandbox? Let's say the server and all clients have the same architecture, and environment (for example 32bit x86-Linux environment). The server shall offer sandbox...
1
by: sachinkale123 | last post by:
Hi, I am reading excel file and reading values from that I am using provider As : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + Filename + ";Extended Properties=\"Excel 8.0;Hdr=No;IMEX=1\"";...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.