Jump to content

store procedure executar a uma determinada hora


Recommended Posts

Bom dia,

Podes criar uma tarefa agendada no Windows Task Scheduler que chama um ficheiro bat ou powershell.

No ficheiro bat usas o SQLCMD e podes indicar (além da autenticação e servidor) um ficheiro de script para ser executado e um ficheiro de output com o resultado. Exemplo:

sqlcmd -E -S LOCALHOST\SQLEXPRESS -i c:\folder\script.sql -o c:\folder\output.txt

Exemplo do ficheiro script.sql:

USE [nome_da_tua_base_dados];

EXEC dbo.MyStoredProcedure;

Espero ter ajudado

Pedro Martins

Sharing is Knowledge!


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.