SQLTeam.com | Weblogs | Forums

How to exclude filenames ending in

sql2012

#1

I have the following script working, I want to exclude files in the list ending in .exe, .dll, .ini any way to do this?

select Sys.Name0, Sys.User_Name0, SF.FilePath, SF.Filename,

Count(SF.FileName) as FileCount,
Sum(SF.FileSize/1024/1024) as 'Used Space'

from v_R_System Sys INNER JOIN v_GS_SoftwareFile SF on
Sys.ResourceID = SF.ResourceID
where SF.FilePath like '%'+'Users'+'%' +'%documents%' and SF.FileSize > 0 Group by Sys.Name0, Sys.User_Name0, SF.Filename, SF.FilePath

having Count(SF.FileName) > 0 order by Sys.Name0 Desc


#2

AND SF.FilePath not like '%.exe'
AND SF.FilePath not like '%.dll'
AND SF.FilePath not like '%.ini'