Wednesday, March 7, 2012

OSQL output

> Is there a way to get the output of the OSQL as tabular values so I can passn">
> the query (without OPENROWSET inside the query) using OSQL, get the result
s
> in tabular format (like a table) and then save the results in main table.
The output of osql.exe is text. You typically need an intermediate
program/script to parse it and reformat it before feeding the result into a
table(s).
Linchi
"Alex" wrote:

> Hi,
> I run a script on all of our SQL Servers (+300 servers) on a regular basis
> to collect information about different instances, version, port and so on
> for each SQL Server using a loop than runs OSQL and passes a query to it f
or
> each member server. The passed query then collects this information on eac
h
> server and saves the results in main server using OPENROWSET.
> Due to different SQL Server and MDAC versions on each member SQL server,
> sometimes OPENROWSET fails to saves its results.
> Is there a way to get the output of the OSQL as tabular values so I can pa
ss
> the query (without OPENROWSET inside the query) using OSQL, get the result
s
> in tabular format (like a table) and then save the results in main table.
> This way, I will avoid using costly OPENROWSET.
> My main server is SQL Server 2000 SP4 and we have different range of SQL
> Servers and SPs.
> Thanks
>
>Hi,
I run a script on all of our SQL Servers (+300 servers) on a regular basis
to collect information about different instances, version, port and so on
for each SQL Server using a loop than runs OSQL and passes a query to it for
each member server. The passed query then collects this information on each
server and saves the results in main server using OPENROWSET.
Due to different SQL Server and MDAC versions on each member SQL server,
sometimes OPENROWSET fails to saves its results.
Is there a way to get the output of the OSQL as tabular values so I can pass
the query (without OPENROWSET inside the query) using OSQL, get the results
in tabular format (like a table) and then save the results in main table.
This way, I will avoid using costly OPENROWSET.
My main server is SQL Server 2000 SP4 and we have different range of SQL
Servers and SPs.
Thanks|||> Is there a way to get the output of the OSQL as tabular values so I can passn">
> the query (without OPENROWSET inside the query) using OSQL, get the result
s
> in tabular format (like a table) and then save the results in main table.
The output of osql.exe is text. You typically need an intermediate
program/script to parse it and reformat it before feeding the result into a
table(s).
Linchi
"Alex" wrote:

> Hi,
> I run a script on all of our SQL Servers (+300 servers) on a regular basis
> to collect information about different instances, version, port and so on
> for each SQL Server using a loop than runs OSQL and passes a query to it f
or
> each member server. The passed query then collects this information on eac
h
> server and saves the results in main server using OPENROWSET.
> Due to different SQL Server and MDAC versions on each member SQL server,
> sometimes OPENROWSET fails to saves its results.
> Is there a way to get the output of the OSQL as tabular values so I can pa
ss
> the query (without OPENROWSET inside the query) using OSQL, get the result
s
> in tabular format (like a table) and then save the results in main table.
> This way, I will avoid using costly OPENROWSET.
> My main server is SQL Server 2000 SP4 and we have different range of SQL
> Servers and SPs.
> Thanks
>
>

No comments:

Post a Comment