I've created an SQL Query in MS SQM Managment Studio and tried it and it works fine. The problem is when i tries to use it in Lan Sweeper. I get the error message:"Incorrect syntax near the word 'Create' ".
Is it possible to use all SQL commands in LanSweeper?
The query I created is the following:
CREATE TABLE #Computers_All (
Computername int, Computer char (30) )
CREATE TABLE #Computers_Symantec (
Computername int, Computer char (30) )
INSERT INTO #Computers_All(Computername, Computer)
SELECT Computername, Computer
FROM tblComputers
INSERT INTO #Computers_Symantec(Computername, Computer)
SELECT tblComputers.Computername, tblComputers.Computer
FROM tblComputers INNER JOIN tblSoftware ON tblComputers.Computername = tblSoftware.ComputerName
WHERE ((tblSoftware.softwareName) Like 'Symantec Antivirus')
SELECT MIN(Computername) as Computername, Computer
FROM
(
SELECT computername, Computer
FROM #Computers_All
UNION ALL
SELECT Computername, computer
FROM #Computers_Symantec
) tmp
GROUP BY Computername, computer
HAVING COUNT(*) = 1
ORDER BY Computer
// Göran W