SQLTeam.com | Weblogs | Forums

SQL Server Agent

Hello,

I have this excel file that sits in a windows directory and is periodically refreshed and copies to an archive folder, but every now and then the file needs to be blank for testing purposes. I'd like to create a SQL Server Agent Job Step that looks at the excel file and says "If the file is blank, don't move to archive, else move to archive."

What might be the best way to do this in the job step? T-SQL or maybe something else like PowerShell?

SSIS
powershell
python

are your options. I would go with bottom 2 myself
please define "If the file is blank"

Yes certainly. It's an excel file with a connection to a view in the sql server database that, when executed, produces a table with multiple columns. Currently, all those columns are blank. There is a sql job that currently uses Powershell to Copy-Item the excel file from one directory to another (archive).

I actually am not sure how I might use T-SQL in the job step to do that, since I'm a bit more versed in Powershell.

Just call powershell from the sql job and reference powershell script