Hi,
I was wondering if it was possible in SQL Server 2005, to be able to
set a job to run, say every 30 seconds? Reason is that we have a job
that runs on our web site which polls every 10 seconds, if it has
finished after 3 polls, then I need to update a few tables. If it's
every minute, then there will be a 30 second wait until the tables are
updated.
Would appreciate any help on this.One option is to have the job constantly running and use WAITFOR inside your TSQL code (in a WHILE
loop).
Or check out http://sqldev.net/sqlagent/SQLAgentRecuringJobsInSecs.htm. The article is for 2000, but
I wouldn't be surprised if it also applies to 2005.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"nomad" <d.bedgood@.btinternet.com> wrote in message
news:e0671520-ce13-4a23-a298-4ff9591e9f99@.n20g2000hsh.googlegroups.com...
> Hi,
> I was wondering if it was possible in SQL Server 2005, to be able to
> set a job to run, say every 30 seconds? Reason is that we have a job
> that runs on our web site which polls every 10 seconds, if it has
> finished after 3 polls, then I need to update a few tables. If it's
> every minute, then there will be a 30 second wait until the tables are
> updated.
> Would appreciate any help on this.|||On Jan 28, 12:03 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> One option is to have the job constantly running and use WAITFOR inside your TSQL code (in a WHILE
> loop).
> Or check outhttp://sqldev.net/sqlagent/SQLAgentRecuringJobsInSecs.htm. The article is for 2000, but
> I wouldn't be surprised if it also applies to 2005.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> "nomad" <d.bedg...@.btinternet.com> wrote in message
> news:e0671520-ce13-4a23-a298-4ff9591e9f99@.n20g2000hsh.googlegroups.com...
> > Hi,
> > I was wondering if it was possible in SQL Server 2005, to be able to
> > set a job to run, say every 30 seconds? Reason is that we have a job
> > that runs on our web site which polls every 10 seconds, if it has
> > finished after 3 polls, then I need to update a few tables. If it's
> > every minute, then there will be a 30 second wait until the tables are
> > updated.
> > Would appreciate any help on this.
That's perfect. Thanks very much Tibor.|||On Jan 28, 11:48 am, nomad <d.bedg...@.btinternet.com> wrote:
> Hi,
> I was wondering if it was possible in SQL Server 2005, to be able to
> set a job to run, say every 30 seconds? Reason is that we have a job
> that runs on our web site which polls every 10 seconds, if it has
> finished after 3 polls, then I need to update a few tables. If it's
> every minute, then there will be a 30 second wait until the tables are
> updated.
> Would appreciate any help on this.
One option is to add 2 schedules to the job. Both jobs run ever
minute but one starts on the minute and one starts at 0:30. This
keeps all the scheduling in the job and doesn't require any code
changes.
Showing posts with label seconds. Show all posts
Showing posts with label seconds. Show all posts
Tuesday, March 20, 2012
Monday, March 12, 2012
Run large sql script via osql takes loooong time
I have a large sql script file. If I open it in Query Analyzer and run it,
it takes about 15 seconds to run. If i run the same file via osql with the
-i argument to specify the sql file, it takes several minutes to run.
Any idea why? Is there a better way to do this?
What i'm really trying to do is execute the sql in a file, from a stored
procedure. So in this instance i'm calling xp_cmdshell to kick off the osql.
like this:
EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
C:\Dev\Current\SQL\DBSchema.sql''')
Is there a better way to execute a sql file in called by a stored procedure?
Thanks,
John
> Any idea why?
It can possibly be because the two environments has different default settings for some SET options,
resulting in different execution plans, or even things like index on views not being used from OSQL.
I'd start by comparing execution plans.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"john conwell" <johnconwell@.discussions.microsoft.com> wrote in message
news:D3232F62-F547-4C96-B9C8-3DE5DAC2FC68@.microsoft.com...
>I have a large sql script file. If I open it in Query Analyzer and run it,
> it takes about 15 seconds to run. If i run the same file via osql with the
> -i argument to specify the sql file, it takes several minutes to run.
> Any idea why? Is there a better way to do this?
> What i'm really trying to do is execute the sql in a file, from a stored
> procedure. So in this instance i'm calling xp_cmdshell to kick off the osql.
> like this:
> EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
> C:\Dev\Current\SQL\DBSchema.sql''')
> Is there a better way to execute a sql file in called by a stored procedure?
> Thanks,
> John
it takes about 15 seconds to run. If i run the same file via osql with the
-i argument to specify the sql file, it takes several minutes to run.
Any idea why? Is there a better way to do this?
What i'm really trying to do is execute the sql in a file, from a stored
procedure. So in this instance i'm calling xp_cmdshell to kick off the osql.
like this:
EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
C:\Dev\Current\SQL\DBSchema.sql''')
Is there a better way to execute a sql file in called by a stored procedure?
Thanks,
John
> Any idea why?
It can possibly be because the two environments has different default settings for some SET options,
resulting in different execution plans, or even things like index on views not being used from OSQL.
I'd start by comparing execution plans.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"john conwell" <johnconwell@.discussions.microsoft.com> wrote in message
news:D3232F62-F547-4C96-B9C8-3DE5DAC2FC68@.microsoft.com...
>I have a large sql script file. If I open it in Query Analyzer and run it,
> it takes about 15 seconds to run. If i run the same file via osql with the
> -i argument to specify the sql file, it takes several minutes to run.
> Any idea why? Is there a better way to do this?
> What i'm really trying to do is execute the sql in a file, from a stored
> procedure. So in this instance i'm calling xp_cmdshell to kick off the osql.
> like this:
> EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
> C:\Dev\Current\SQL\DBSchema.sql''')
> Is there a better way to execute a sql file in called by a stored procedure?
> Thanks,
> John
Run large sql script via osql takes loooong time
I have a large sql script file. If I open it in Query Analyzer and run it,
it takes about 15 seconds to run. If i run the same file via osql with the
-i argument to specify the sql file, it takes several minutes to run.
Any idea why? Is there a better way to do this?
What i'm really trying to do is execute the sql in a file, from a stored
procedure. So in this instance i'm calling xp_cmdshell to kick off the osql.
like this:
EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
C:\Dev\Current\SQL\DBSchema.sql''')
Is there a better way to execute a sql file in called by a stored procedure?
Thanks,
John> Any idea why?
It can possibly be because the two environments has different default settings for some SET options,
resulting in different execution plans, or even things like index on views not being used from OSQL.
I'd start by comparing execution plans.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"john conwell" <johnconwell@.discussions.microsoft.com> wrote in message
news:D3232F62-F547-4C96-B9C8-3DE5DAC2FC68@.microsoft.com...
>I have a large sql script file. If I open it in Query Analyzer and run it,
> it takes about 15 seconds to run. If i run the same file via osql with the
> -i argument to specify the sql file, it takes several minutes to run.
> Any idea why? Is there a better way to do this?
> What i'm really trying to do is execute the sql in a file, from a stored
> procedure. So in this instance i'm calling xp_cmdshell to kick off the osql.
> like this:
> EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
> C:\Dev\Current\SQL\DBSchema.sql''')
> Is there a better way to execute a sql file in called by a stored procedure?
> Thanks,
> John
it takes about 15 seconds to run. If i run the same file via osql with the
-i argument to specify the sql file, it takes several minutes to run.
Any idea why? Is there a better way to do this?
What i'm really trying to do is execute the sql in a file, from a stored
procedure. So in this instance i'm calling xp_cmdshell to kick off the osql.
like this:
EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
C:\Dev\Current\SQL\DBSchema.sql''')
Is there a better way to execute a sql file in called by a stored procedure?
Thanks,
John> Any idea why?
It can possibly be because the two environments has different default settings for some SET options,
resulting in different execution plans, or even things like index on views not being used from OSQL.
I'd start by comparing execution plans.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"john conwell" <johnconwell@.discussions.microsoft.com> wrote in message
news:D3232F62-F547-4C96-B9C8-3DE5DAC2FC68@.microsoft.com...
>I have a large sql script file. If I open it in Query Analyzer and run it,
> it takes about 15 seconds to run. If i run the same file via osql with the
> -i argument to specify the sql file, it takes several minutes to run.
> Any idea why? Is there a better way to do this?
> What i'm really trying to do is execute the sql in a file, from a stored
> procedure. So in this instance i'm calling xp_cmdshell to kick off the osql.
> like this:
> EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
> C:\Dev\Current\SQL\DBSchema.sql''')
> Is there a better way to execute a sql file in called by a stored procedure?
> Thanks,
> John
Run large sql script via osql takes loooong time
I have a large sql script file. If I open it in Query Analyzer and run it,
it takes about 15 seconds to run. If i run the same file via osql with the
-i argument to specify the sql file, it takes several minutes to run.
Any idea why? Is there a better way to do this?
What i'm really trying to do is execute the sql in a file, from a stored
procedure. So in this instance i'm calling xp_cmdshell to kick off the osql
.
like this:
EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
C:\Dev\Current\SQL\DBSchema.sql''')
Is there a better way to execute a sql file in called by a stored procedure?
Thanks,
John> Any idea why?
It can possibly be because the two environments has different default settin
gs for some SET options,
resulting in different execution plans, or even things like index on views n
ot being used from OSQL.
I'd start by comparing execution plans.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"john conwell" <johnconwell@.discussions.microsoft.com> wrote in message
news:D3232F62-F547-4C96-B9C8-3DE5DAC2FC68@.microsoft.com...
>I have a large sql script file. If I open it in Query Analyzer and run it,
> it takes about 15 seconds to run. If i run the same file via osql with th
e
> -i argument to specify the sql file, it takes several minutes to run.
> Any idea why? Is there a better way to do this?
> What i'm really trying to do is execute the sql in a file, from a stored
> procedure. So in this instance i'm calling xp_cmdshell to kick off the os
ql.
> like this:
> EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
> C:\Dev\Current\SQL\DBSchema.sql''')
> Is there a better way to execute a sql file in called by a stored procedur
e?
> Thanks,
> John
it takes about 15 seconds to run. If i run the same file via osql with the
-i argument to specify the sql file, it takes several minutes to run.
Any idea why? Is there a better way to do this?
What i'm really trying to do is execute the sql in a file, from a stored
procedure. So in this instance i'm calling xp_cmdshell to kick off the osql
.
like this:
EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
C:\Dev\Current\SQL\DBSchema.sql''')
Is there a better way to execute a sql file in called by a stored procedure?
Thanks,
John> Any idea why?
It can possibly be because the two environments has different default settin
gs for some SET options,
resulting in different execution plans, or even things like index on views n
ot being used from OSQL.
I'd start by comparing execution plans.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"john conwell" <johnconwell@.discussions.microsoft.com> wrote in message
news:D3232F62-F547-4C96-B9C8-3DE5DAC2FC68@.microsoft.com...
>I have a large sql script file. If I open it in Query Analyzer and run it,
> it takes about 15 seconds to run. If i run the same file via osql with th
e
> -i argument to specify the sql file, it takes several minutes to run.
> Any idea why? Is there a better way to do this?
> What i'm really trying to do is execute the sql in a file, from a stored
> procedure. So in this instance i'm calling xp_cmdshell to kick off the os
ql.
> like this:
> EXEC ('xp_cmdshell ''osql -E -n -S myServer -d ' + @.newDbName + ' -i
> C:\Dev\Current\SQL\DBSchema.sql''')
> Is there a better way to execute a sql file in called by a stored procedur
e?
> Thanks,
> John
Subscribe to:
Posts (Atom)