June 17, 2009 at 7:36 am
Hi All,
Wally the struggling DBA one again... 🙂
I am looking for a simple way to query a table for row count, and if there are any rows in the table (indicating a backup of the application) we want to execute a batch script on the server via XP_CMDSHELL to deal with some flaky services.
What type of logic will work when rowcount > 0 to do this?
Thanks in advance for your guidance!
Wally
[font="Verdana"]-- Wally
-- Reluctant DBA[/font]
June 17, 2009 at 8:50 pm
Well, to check for a table's rowcount being > 0, I would try this:
if exists (select 1 from table)
execute master..xp_cmdshell ...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 18, 2009 at 9:08 am
Thanks Wayne - I think that will do it!
[font="Verdana"]-- Wally
-- Reluctant DBA[/font]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply