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 2005 Forums
 Transact-SQL (2005)
 running query to determine if i can...

Author  Topic 

duhaas
Constraint Violating Yak Guru

310 Posts

Posted - 2011-02-17 : 17:18:41
I'm looking to figure out a way to run the following:
select case
when sum(items_processed) = sum(total_items)
and count(type) = 9 then 0
else 1
end
from log
where [type] = 'History'
and user_name = 'MI\techimc'
and description <> ''
and convert(VARCHAR(10), scheduled_date, 110) = convert(VARCHAR(10), getdate(), 110)
group by [type]


having it keep running until 0 is returned, when 0 is returned, i want to run the following sql

insert into PERFORM..schedule 
(Event_Type_ID,
Start_Time,
Input_XML,
Time_Type,
Exclude_Holidays,
User_Name,
Enable,
Name,
Stop_Time,
Days_To_Run,
Exclude_Dates)
Values
(
'1',
dateadd(mi,1,(cast(getdate()as smalldatetime))), --Change This and the following highlighted sections
'dd',
'O',
'0',
'MI-MKE-IMCPAPP3',
'1',
'Run Report:MV on All Composites',
'12/30/1899 12:00:00 AM',
'',
''
)


Any thoughts or help you can provide i would appreciate. I'm basically looking for a way to trigger something in the application to run once another job is complete, and since the vendor is useless, we are trying to come up with a solution that doesn't require a console app and that can just be done using sql.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-02-17 : 17:54:56
Use WHILE @@ROWCOUNT > 0.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -