Tuesday, February 14, 2012

Command to export data from sql server to text file in sql query analyzer

Hi,
Does anyone know how to export a query to a text file by using query
analyzer with command, i dun want to manual click it.
--
Thanks a lot!
regards,
florenceleeDo you mean save the results to a file? If so, you can set the output of
the query to go to Text, Grid or File from the Query pull-down menu. If you
don't even want to do that then you could use osql.exe rather than Query
Analyzer. The -o parameter allows you to specify an output file to which
you'd like the query results to go.
--
Cheers,
Mike
"Florencelee" <florencelee@.visualsolutions.com.my> wrote in message
news:uQMYVup0EHA.2572@.tk2msftngp13.phx.gbl...
> Hi,
> Does anyone know how to export a query to a text file by using query
> analyzer with command, i dun want to manual click it.
>
> --
> Thanks a lot!
> regards,
> florencelee
>|||Hi,
I understand by using osql, can use sql quey analyzer and i dun want
to output to text file and save manually, i just want a command which can
behave in the same way as in osql but i need to do in query analyzer'
--
Thanks a lot!
regards,
florencelee
"Florencelee" <florencelee@.visualsolutions.com.my> wrote in message
news:uQMYVup0EHA.2572@.tk2msftngp13.phx.gbl...
> Hi,
> Does anyone know how to export a query to a text file by using query
> analyzer with command, i dun want to manual click it.
>
> --
> Thanks a lot!
> regards,
> florencelee
>|||There's not a TSQL command for that. Most of us who need to do this in TSQL use xp_cmdshell and
OSQL.EXE.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Florencelee" <florencelee@.visualsolutions.com.my> wrote in message
news:%23CjGX9r0EHA.1932@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I understand by using osql, can use sql quey analyzer and i dun want
> to output to text file and save manually, i just want a command which can
> behave in the same way as in osql but i need to do in query analyzer'
> --
> Thanks a lot!
> regards,
> florencelee
> "Florencelee" <florencelee@.visualsolutions.com.my> wrote in message
> news:uQMYVup0EHA.2572@.tk2msftngp13.phx.gbl...
> > Hi,
> > Does anyone know how to export a query to a text file by using query
> > analyzer with command, i dun want to manual click it.
> >
> >
> > --
> > Thanks a lot!
> >
> > regards,
> >
> > florencelee
> >
> >
>|||Florencelee,
Press Ctrl-Shift-F in Query Analyzer.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Florencelee wrote:
> Hi,
> Does anyone know how to export a query to a text file by using query
> analyzer with command, i dun want to manual click it.
>
> --
> Thanks a lot!
> regards,
> florencelee
>|||You can use xp_cmdshell and BCP OUT ... This combination works great...
Thanks
GYK
"Tibor Karaszi" wrote:
> There's not a TSQL command for that. Most of us who need to do this in TSQL use xp_cmdshell and
> OSQL.EXE.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Florencelee" <florencelee@.visualsolutions.com.my> wrote in message
> news:%23CjGX9r0EHA.1932@.TK2MSFTNGP09.phx.gbl...
> > Hi,
> >
> > I understand by using osql, can use sql quey analyzer and i dun want
> > to output to text file and save manually, i just want a command which can
> > behave in the same way as in osql but i need to do in query analyzer'
> >
> > --
> > Thanks a lot!
> >
> > regards,
> >
> > florencelee
> > "Florencelee" <florencelee@.visualsolutions.com.my> wrote in message
> > news:uQMYVup0EHA.2572@.tk2msftngp13.phx.gbl...
> > > Hi,
> > > Does anyone know how to export a query to a text file by using query
> > > analyzer with command, i dun want to manual click it.
> > >
> > >
> > > --
> > > Thanks a lot!
> > >
> > > regards,
> > >
> > > florencelee
> > >
> > >
> >
> >
>
>

No comments:

Post a Comment