Showing posts with label utility. Show all posts
Showing posts with label utility. Show all posts

Monday, March 26, 2012

Looping through Command Line Results...

I want to run a command line utility and return the results. I'm pretty sure
I
know how to do that. What's the best practice for looping through the results
to find specific information from the results of the command line?
Say I want to search for a string "computername" in each returned row.
Thanks.
On Fri, 20 Jul 2007 10:32:05 -0700, Joe
<Joe@.discussions.microsoft.com> wrote:

>I want to run a command line utility and return the results. I'm pretty sure
>I
>know how to do that. What's the best practice for looping through the results
>to find specific information from the results of the command line?
>Say I want to search for a string "computername" in each returned row.
>Thanks.
There are diverse and contradictory way to interpret your question.
One would be that you want to run SQL Server commands from the command
prompt (sometimes called the DOS prompt). OSQL would let you run the
commands, and it is common to save the results to a .txt file. It is
possible to search a .txt file using the command line utility FIND.
Another interpretation of your question is that you intend to run
something from within SQL Server using xp_cmdshell and wish to search
the results. The approach in that case is to create a table with one
column (varchar(255) and then:
INSERT ThatTable (ThatColumn)
EXEC master..xp_cmdshell 'some command here'
After which you can search the table using SELECT and LIKE. If the
sequence of the rows is significant, include an IDENTITY column in the
table definition so that you can tell which order the rows came in.
A third interpreation could be that your question has nothing to do
with SQL Server and belongs somewhere else.
Perhaps you would like to clarify?
Roy Harvey
Beacon Falls, CT
|||Roy,
Thank you, and sorry for being unclear. The second answer is what I was
planning
and how I will do it. I just wasnt sure if I ran xp_cmdshell if I could
just loop
through the results without having to populate a table.
Thanks again.
"Roy Harvey" wrote:

> On Fri, 20 Jul 2007 10:32:05 -0700, Joe
> <Joe@.discussions.microsoft.com> wrote:
>
> There are diverse and contradictory way to interpret your question.
> One would be that you want to run SQL Server commands from the command
> prompt (sometimes called the DOS prompt). OSQL would let you run the
> commands, and it is common to save the results to a .txt file. It is
> possible to search a .txt file using the command line utility FIND.
> Another interpretation of your question is that you intend to run
> something from within SQL Server using xp_cmdshell and wish to search
> the results. The approach in that case is to create a table with one
> column (varchar(255) and then:
> INSERT ThatTable (ThatColumn)
> EXEC master..xp_cmdshell 'some command here'
> After which you can search the table using SELECT and LIKE. If the
> sequence of the rows is significant, include an IDENTITY column in the
> table definition so that you can tell which order the rows came in.
> A third interpreation could be that your question has nothing to do
> with SQL Server and belongs somewhere else.
> Perhaps you would like to clarify?
> Roy Harvey
> Beacon Falls, CT
>

Looping through Command Line Results...

I want to run a command line utility and return the results. I'm pretty sur
e
I
know how to do that. What's the best practice for looping through the resul
ts
to find specific information from the results of the command line?
Say I want to search for a string "computername" in each returned row.
Thanks.On Fri, 20 Jul 2007 10:32:05 -0700, Joe
<Joe@.discussions.microsoft.com> wrote:

>I want to run a command line utility and return the results. I'm pretty su
re
>I
>know how to do that. What's the best practice for looping through the resu
lts
>to find specific information from the results of the command line?
>Say I want to search for a string "computername" in each returned row.
>Thanks.
There are diverse and contradictory way to interpret your question.
One would be that you want to run SQL Server commands from the command
prompt (sometimes called the DOS prompt). OSQL would let you run the
commands, and it is common to save the results to a .txt file. It is
possible to search a .txt file using the command line utility FIND.
Another interpretation of your question is that you intend to run
something from within SQL Server using xp_cmdshell and wish to search
the results. The approach in that case is to create a table with one
column (varchar(255) and then:
INSERT ThatTable (ThatColumn)
EXEC master..xp_cmdshell 'some command here'
After which you can search the table using SELECT and LIKE. If the
sequence of the rows is significant, include an IDENTITY column in the
table definition so that you can tell which order the rows came in.
A third interpreation could be that your question has nothing to do
with SQL Server and belongs somewhere else.
Perhaps you would like to clarify?
Roy Harvey
Beacon Falls, CT|||Roy,
Thank you, and sorry for being unclear. The second answer is what I was
planning
and how I will do it. I just wasnt sure if I ran xp_cmdshell if I could
just loop
through the results without having to populate a table.
Thanks again.
"Roy Harvey" wrote:

> On Fri, 20 Jul 2007 10:32:05 -0700, Joe
> <Joe@.discussions.microsoft.com> wrote:
>
> There are diverse and contradictory way to interpret your question.
> One would be that you want to run SQL Server commands from the command
> prompt (sometimes called the DOS prompt). OSQL would let you run the
> commands, and it is common to save the results to a .txt file. It is
> possible to search a .txt file using the command line utility FIND.
> Another interpretation of your question is that you intend to run
> something from within SQL Server using xp_cmdshell and wish to search
> the results. The approach in that case is to create a table with one
> column (varchar(255) and then:
> INSERT ThatTable (ThatColumn)
> EXEC master..xp_cmdshell 'some command here'
> After which you can search the table using SELECT and LIKE. If the
> sequence of the rows is significant, include an IDENTITY column in the
> table definition so that you can tell which order the rows came in.
> A third interpreation could be that your question has nothing to do
> with SQL Server and belongs somewhere else.
> Perhaps you would like to clarify?
> Roy Harvey
> Beacon Falls, CT
>

Looping through Command Line Results...

I want to run a command line utility and return the results. I'm pretty sure
I
know how to do that. What's the best practice for looping through the results
to find specific information from the results of the command line?
Say I want to search for a string "computername" in each returned row.
Thanks.On Fri, 20 Jul 2007 10:32:05 -0700, Joe
<Joe@.discussions.microsoft.com> wrote:
>I want to run a command line utility and return the results. I'm pretty sure
>I
>know how to do that. What's the best practice for looping through the results
>to find specific information from the results of the command line?
>Say I want to search for a string "computername" in each returned row.
>Thanks.
There are diverse and contradictory way to interpret your question.
One would be that you want to run SQL Server commands from the command
prompt (sometimes called the DOS prompt). OSQL would let you run the
commands, and it is common to save the results to a .txt file. It is
possible to search a .txt file using the command line utility FIND.
Another interpretation of your question is that you intend to run
something from within SQL Server using xp_cmdshell and wish to search
the results. The approach in that case is to create a table with one
column (varchar(255) and then:
INSERT ThatTable (ThatColumn)
EXEC master..xp_cmdshell 'some command here'
After which you can search the table using SELECT and LIKE. If the
sequence of the rows is significant, include an IDENTITY column in the
table definition so that you can tell which order the rows came in.
A third interpreation could be that your question has nothing to do
with SQL Server and belongs somewhere else.
Perhaps you would like to clarify?
Roy Harvey
Beacon Falls, CT|||Roy,
Thank you, and sorry for being unclear. The second answer is what I was
planning
and how I will do it. I just wasnt sure if I ran xp_cmdshell if I could
just loop
through the results without having to populate a table.
Thanks again.
"Roy Harvey" wrote:
> On Fri, 20 Jul 2007 10:32:05 -0700, Joe
> <Joe@.discussions.microsoft.com> wrote:
> >I want to run a command line utility and return the results. I'm pretty sure
> >I
> >know how to do that. What's the best practice for looping through the results
> >to find specific information from the results of the command line?
> >
> >Say I want to search for a string "computername" in each returned row.
> >
> >Thanks.
> There are diverse and contradictory way to interpret your question.
> One would be that you want to run SQL Server commands from the command
> prompt (sometimes called the DOS prompt). OSQL would let you run the
> commands, and it is common to save the results to a .txt file. It is
> possible to search a .txt file using the command line utility FIND.
> Another interpretation of your question is that you intend to run
> something from within SQL Server using xp_cmdshell and wish to search
> the results. The approach in that case is to create a table with one
> column (varchar(255) and then:
> INSERT ThatTable (ThatColumn)
> EXEC master..xp_cmdshell 'some command here'
> After which you can search the table using SELECT and LIKE. If the
> sequence of the rows is significant, include an IDENTITY column in the
> table definition so that you can tell which order the rows came in.
> A third interpreation could be that your question has nothing to do
> with SQL Server and belongs somewhere else.
> Perhaps you would like to clarify?
> Roy Harvey
> Beacon Falls, CT
>sql

Monday, March 12, 2012

Lookup table insert, update, and delete...

All,

Just wondering if anyone is aware of a SQL server shareware utility that places a front end on a table to manage insert, update, and delete of rows on a lookup table.

We can certainly write this but before reinventing the wheel I figure I'd ask and see.

Many Thanks,

IsaacThe DB Explorer works extensively with look-ups. You will have to define the relationship by referential constraints in the database, or as navigation paths in the client front-end.

You find all resources at MayeticVillage (http://www.MayeticVillage.com/DB-Explorer)

I'll be glad to answer all your questions about it.|||You can edit table data directly in Enterprise Manager.|||You can even use the query analyzer to maintain your data by DML statements, but I invite you to experience the ease of working with the DB Explorer.|||Gosh, I had no idea that DB Explorer was "shareware".

And all this time I've been going to the trouble of right-clicking on any table in Enterprise Manager and selecting "Open Table/Return All Rows"...|||The idea behind the DB Explorer is to exploit the essence of the relational model: the relationship between entities. To work with single tables / views is simpel, any tool including the Enterprise Manager can do so. To put a table / view into a relational context is normally the exclusive domain of client application development, but the DB Explorer is able to generate a user interface on-the-fly, including lookups.

Moreover, you can instantly use the relationships to navigate through your data: from a customer record to the related order records, or vise versa from an order to the corresponding customer. Even within the Enterprise Manager with its knowledge of the existing relations, you would have to write SQL to do so; the DB Explorer works (almost) completely without SQL in the GUI.

Actually, the DB Explorer isn't shareware but freeware. The only restriction is that it can be used in a stand-alone / Client/Server configuration only. As soon as you want to use the tool in a three-tier or/and multi-user configuration, an evaluation period of 1 month will start.

Why don't you give it a try?|||The problem I have with using enterprise mgr or query analyzer is that the users who will be doing the updates are very untechnical.

Ideally, I'd like to provide just a nice front end to the 4 or 5 tables that matter to them.

I can't overwhelm them with database names, a zillion other tables in a large list of tables, and cryptic column names etc etc etc.

Thanks,

Isaac|||Then your cheapest solution is to create an Access Data Project linked to your SQL Server database, with an entry form for each table.|||...Even cheaper would be to create updateable views and grant all permissions to those rather than the tables themselves.|||I think he is looking for a simple user interface, but it would definitely be a good idea to create the views you suggested, along with a login/role that only has access to those views, before allowing people into the database through an Access Data Project. Once they get into the .ADP file, they can get into anything their login allows, or that is poorly secured.|||The problem I have with using enterprise mgr or query analyzer is that the users who will be doing the updates are very untechnical.

Ideally, I'd like to provide just a nice front end to the 4 or 5 tables that matter to them.

I can't overwhelm them with database names, a zillion other tables in a large list of tables, and cryptic column names etc etc etc.
Isaac

Please note that the DB Explorer allows you to present just the tables you need, with functional table and field names. There is also a quite complex access control mechanism integrated, which would allow you to grant read-write access to lookup tables, and read-only access or no access at all to other tables.|||Please note that the poster requested a shareware solution. He did not ask for you to push your companys product by touting all the things it does which can also be done through Enterprise Manager.

DBForums has a Marketplace forum if you wish to advertise.|||Please note that the poster requested a shareware solution. He did not ask for you to push your companys product by touting all the things it does which can also be done through Enterprise Manager.

Which part of the freeware property or extended functionality which is definitively NOT possible with Enterprise Manager didn't you understand?|||So your software is free? My apologies...|||Apologies granted. :cool:

Donatations, however, are always appreciated.|||Curious. Why does your website offer a trial-version of DB Explorer if it is freeware?

I don't want to bother with the demo version. Please post the link where I can just download the entire thing for free.

Thanks!|||Curious. Why does your website offer a trial-version of DB Explorer if it is freeware?

I don't want to bother with the demo version. Please post the link where I can just download the entire thing for free.

Thanks!

Thank you for pointing me for that, the label is misleading. I've changed it. Note, that for trying the software, you will need to have MDAC version 2.8 or higher.