Search code examples
sql-serversql-server-2005auto-update

Automated Update SQL Server


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).


Solution

  • 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