|
sql
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
select results into file
Hi,
i believe the results from a select query can be output into a file but i do not want to use the Query Analyzer's -->Query-->Results to file , so how can i specify the file name directly from the SELECT statement ? e.g SELECT * from a and out into a file appreciate any advice tks & rdgs Try using isql via the query analyzer as a quick and dirty method
replace <user>, <password>, <server>, <database>, & <query> it produces a file in your c: root drive called fileout.txt use master go xp_cmdshell 'isql -U<user> -P<password> -S<server> -d<database> -w8000 -q"<query>" -oc:\ fileout.txt' Show quoteHide quote "maxzsim" <maxz***@discussions.microsoft.com> wrote in message news:DFA8AE30-0AEF-43CB-94DD-C94644B09BE2@microsoft.com... > Hi, > > i believe the results from a select query can be output into a file but i > do not want to use the Query Analyzer's -->Query-->Results to file , so how > can i specify the file name directly from the SELECT statement ? > > e.g SELECT * from a and out into a file > > appreciate any advice > > tks & rdgs Hi,
Actually i need to schedule the task so i was thinking if i could directly specify from the selct statement then i need not keep track of too much things anyway , i have created a DTSjob to do the export into a text file tks & rdgs Show quoteHide quote "Armando Prato" wrote: > > Try using isql via the query analyzer as a quick and dirty method > > replace <user>, <password>, <server>, <database>, & <query> > > it produces a file in your c: root drive called fileout.txt > > use master > go > xp_cmdshell > 'isql -U<user> -P<password> -S<server> -d<database> -w8000 -q"<query>" -oc:\ > fileout.txt' > > > > "maxzsim" <maxz***@discussions.microsoft.com> wrote in message > news:DFA8AE30-0AEF-43CB-94DD-C94644B09BE2@microsoft.com... > > Hi, > > > > i believe the results from a select query can be output into a file but i > > do not want to use the Query Analyzer's -->Query-->Results to file , so > how > > can i specify the file name directly from the SELECT statement ? > > > > e.g SELECT * from a and out into a file > > > > appreciate any advice > > > > tks & rdgs > > >
Other interesting topics
Can I use Top here and I'm stuck on how to get the results I'm looking for
Effects of Intel Hyperthreading on SQL Server Restoring model and msdb databases goes to wrong file locations DBCC CHECKDB Error How do I measure the cost of compiling an execution plan? select string rows Transaction Log Backup complete yet shows as failed? stored procedure return table check job status hot spots |
|||||||||||||||||||||||