You are here: Re: Update Status Field after Expiry Date « MsSQL Server « IT news, forums, messages
Re: Update Status Field after Expiry Date

Posted by AlterEgo on 03/26/07 23:10

Shane,

If you have access to the database from your workstation (and it seems as
though you do), you can create a batch file using osql and schedule it to
run nightly (or more often) using Windows scheduled tasks.

osql -S servername -U userid -P password -q "update Customer set
accountStatus = 0 where accountExpiryDate < CURRENT_TIMESTAMP and
isnull(accountStatus,1) = 1"

-- Bill

<shane.taylor81@gmail.com> wrote in message
news:1174949088.848194.24550@r56g2000hsd.googlegroups.com...
> Consider the following table
>
> Customer
> custId char(10)
> accountExpiryDate datetime
> accountStatus bit
>
> Now, I want to update the accountStatus to False as soon as the
> current date becomes accountExpiryDate.
>
> I think it can be done using "SQL Agent" but my webhost doesnt provide
> me access to that. I have access only to the Query Analyzer.
>
> Thanks
> Shane
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация