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...
>
Showing posts with label click. Show all posts
Showing posts with label click. Show all posts
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,
florencelee
Do 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...
>
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
Do 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...
>
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
> > >
> > >
> >
> >
>
>
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
> > >
> > >
> >
> >
>
>
Sunday, February 12, 2012
command line
Using Query Analyzer, I can right click on an object and select "script
object to new window as create" and I get the text of the object's
definition (schema). Can I get same result from command line, i.e., from
osql, I can get text output for the definition of the object (something like
defncopy under Sybase)? If so, what is the command or store procedure name?
object to new window as create" and I get the text of the object's
definition (schema). Can I get same result from command line, i.e., from
osql, I can get text output for the definition of the object (something like
defncopy under Sybase)? If so, what is the command or store procedure name?
Thanks in advance.Unfortunately not. You can look at scptxfr.exe (it's installed with
MSSQL server - run it with /? to see the options), which is a
command-line tool used during an upgrade process. But it's not
documented, and it doesn't give you the same flexibility as the QA/EM
scripting fucntionality.
The best general solution is probably to write your own scripts using
the SQLDMO COM interface, which exposes .Script methods for all MSSQL
objects - the details are in Books Online. Or there are plenty of
third-party tools to do this as well.
Simon|||Hi Dav,
Take a look at this sample. I guess this helps you. It is really good.
http://www.databasejournal.com/feat...10894_3401081_1
Thank you
Raju
Subscribe to:
Posts (Atom)