views:

60

answers:

1

Hello,

I have a table of topics, topics might have an automatic publish date, I want to make SQL Server auto publishes them.

Previously I made it in code on each call to any method of the topics adapter, but I wanna make it automatically in SQL Server.

Can I?

It might be some kinda scheduled job or something like that.

I'm using SQL Server 2005 (Express and Professional).

+1  A: 

What do you mean by 'publish'? It definitely sounds like you could use a SQL Server Agent job, to execute, say

UPDATE topics SET published = 1 WHERE publishdate < getdate()

if that is what all what you want to do, when you refer to 'auto publish'

EDIT

Since a SQL Server Agent job won't do. How about modifying your selects instead?

SELECT
   (published OR publishdate < getdate()) as published
FROM
   topics
David Hedlund
I linked to SQL Server Agent explanations for you. However, it's worth noting that SQL Server Express doesn't come with SQL Server Agent. You need Standard+ for this.
Eric
Thanks for answering, I know I have to user SQL Server Agent, but as Eric commented, I have SQL Express :(Is there another way?
mpcabd
oh. thanks for pointing out. set up a simple windows service, perhaps, that's running in the background and polling the database to execute an sp at a given interval? it's quite simple to do in .net, at least, but no, it's not all-sql.
David Hedlund
(i also added an alternative approach in an edit to this post, but i actually think i'd prefer to go for the win service myself)
David Hedlund
Thanks for the service point, but I'm running the webiste at a remote host that I can't install services on.I liked the other approach, I'll try to find a way to put it in my code again :)Thanks.
mpcabd