Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Looping through records in ANSI SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-02 : 10:13:52
Chris, writes "I am a coop student and I am currently on the job stumped out of my wits as to what to do with this problem. We just ran an inventory on our network (here at work) and my superiors have given me this file which includes all the executables on all the computers in our network in csv format. I have to be able to run three queries on this information:
1) Show all software with only 1 instance on the Network(probably software from home which we don't want)
2) Software Common to ALL machines (MSOffice, etc)
3) Software Common to departments.

So from this master list I have generated a list of unique software names using the DISTINCT command. So my next step is to compare all the unique software names with the list and see how many times they come up. Using the COUNT command I can do this:
SELECT COUNT(*)
FROM Software //the table name
WHERE SWname = "Internet Explorer"; //or any file
With this SQL will count how many Instances of IE we have on our network. But the problem is I need to do this for every executble out there (in my unique names list) of which there are 1700, so in other words loop through these records, count the instances and save them with the software name in a file. I am not allowed to use C,C++,JAVA,VB,PHP,... with embedded SQL commands(which would make life very simple), so I have to use ANSI SQL. I have searched all day now and I am fearing that there are no program control commands ie loops with which I could iterate through the information. If I am wrong please tell me the functions, or if you know a way to accomplish the task a different way, I am open to suggestions. Thanks"
   

- Advertisement -