473,594 Members | 2,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run SQL script on Instance Startup


Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2

thanks!

Oct 18 '07 #1
3 11279
On Oct 18, 11:50 am, traceable1 <thham...@gmail .comwrote:
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2

thanks!
This link describes the use of 'Automatic Execution Stored Procedures'
than may fit the bill for what you are looking for.

http://msdn2.microsoft.com/en-us/library/ms191129.aspx

Oct 18 '07 #2

Thank you!!
On Oct 18, 3:56 pm, Steve215 <stephen.mer... @comcast.netwro te:
On Oct 18, 11:50 am, traceable1 <thham...@gmail .comwrote:
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!

This link describes the use of 'Automatic Execution Stored Procedures'
than may fit the bill for what you are looking for.

http://msdn2.microsoft.com/en-us/library/ms191129.aspx

Oct 18 '07 #3


Tibor Karaszi View profile
More options Oct 18, 10:58 am

Newsgroups: microsoft.publi c.sqlserver.ser ver
From: "Tibor Karaszi"
<tibor_please.n o.email_kara... @hotmail.nomail .com>
Date: Thu, 18 Oct 2007 17:58:37 +0200
Local: Thurs, Oct 18 2007 10:58 am
Subject: Re: Run script on Instance Startup
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
Put it in a stored procedure and mark the proc as an autostart proc
(sp_procoption) .

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

"traceable1 " <thham...@gmail .comwrote in message
news:11******** *************@y 27g2000pre.goog legroups.com...
- Hide quoted text -
- Show quoted text -
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!


Reply Reply to author Forward Rate this post: Text
for clearing space



You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.

Tibor Karaszi View profile
More options Oct 18, 1:27 pm

Newsgroups: microsoft.publi c.sqlserver.ser ver
From: "Tibor Karaszi"
<tibor_please.n o.email_kara... @hotmail.nomail .com>
Date: Thu, 18 Oct 2007 20:27:45 +0200
Local: Thurs, Oct 18 2007 1:27 pm
Subject: Re: Run script on Instance Startup
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
Actually, one can claim that your alternative, Ekrem, is a cleaner
solution than mine. I.e., it
might feel better to have a client app (Agent) execute whatever TSQL
commands you want to run
instead of the database engine. (Of course, if one only start the
engine and not Agent, then the
script will not be executed.)

Good thinking. :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

"Ekrem Önsoy" <ek...@btegitim .comwrote in message
news:18******** *************** ***********@mic rosoft.com...
- Hide quoted text -
- Show quoted text -
Alternatively you can create a job to run your stuff which starts when SQL Server Agent starts...
(may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
--
Ekrem Önsoy
"traceable1 " <thham...@gmail .comwrote in message
news:11******** *************@y 27g2000pre.goog legroups.com...
>Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
>thanks!


Reply Reply to author Forward Rate this post: Text
for clearing space



You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.

traceable1 View profile
More options Oct 18, 3:34 pm

Newsgroups: microsoft.publi c.sqlserver.ser ver
From: traceable1 <thham...@gmail .com>
Date: Thu, 18 Oct 2007 20:34:43 -0000
Local: Thurs, Oct 18 2007 3:34 pm
Subject: Re: Run script on Instance Startup
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this
author
Thank you so much for your feedback!
So how exactly would I set up the script to run when the Agent
starts?
On Oct 18, 1:27 pm, "Tibor Karaszi"

- Hide quoted text -
- Show quoted text -

<tibor_please.n o.email_kara... @hotmail.nomail .comwrote:
Actually, one can claim that your alternative, Ekrem, is a cleaner solution than mine. I.e., it
might feel better to have a client app (Agent) execute whatever TSQL commands you want to run
instead of the database engine. (Of course, if one only start the engine and not Agent, then the
script will not be executed.)
Good thinking. :-)
--
Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp ://sqlblog.com/blogs/...
"Ekrem Önsoy" <ek...@btegitim .comwrote in message
news:18******** *************** ***********@mic rosoft.com...
Alternatively you can create a job to run your stuff which starts when SQL Server Agent starts...
(may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
--
Ekrem Önsoy
"traceable1 " <thham...@gmail .comwrote in message
news:11******** *************@y 27g2000pre.goog legroups.com...
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!- Hide quoted text -
- Show quoted text -


Reply Reply to author Forward



You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.

Tibor Karaszi View profile
More options Oct 18, 3:59 pm

Newsgroups: microsoft.publi c.sqlserver.ser ver
From: "Tibor Karaszi"
<tibor_please.n o.email_kara... @hotmail.nomail .com>
Date: Thu, 18 Oct 2007 22:59:38 +0200
Local: Thurs, Oct 18 2007 3:59 pm
Subject: Re: Run script on Instance Startup
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
Create an Agent job with one or several job steps containing your TSQL
(or whatever) code. Schedule
this job to be executed when Agent starts.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

"traceable1 " <thham...@gmail .comwrote in message
news:11******** *************@k 35g2000prh.goog legroups.com...

Thank you so much for your feedback!
So how exactly would I set up the script to run when the Agent
starts?
On Oct 18, 1:27 pm, "Tibor Karaszi"

- Hide quoted text -
- Show quoted text -

<tibor_please.n o.email_kara... @hotmail.nomail .comwrote:
Actually, one can claim that your alternative, Ekrem, is a cleaner solution than mine. I.e., it
might feel better to have a client app (Agent) execute whatever TSQL commands you want to run
instead of the database engine. (Of course, if one only start the engine and not Agent, then the
script will not be executed.)
Good thinking. :-)
--
Tibor Karaszi, SQL Server
MVPhttp://www.karaszi.com/sqlserver/default.asphttp ://sqlblog.com/blogs/....
"Ekrem Önsoy" <ek...@btegitim .comwrote in message
news:18******** *************** ***********@mic rosoft.com...
Alternatively you can create a job to run your stuff which starts when SQL Server Agent
starts...
(may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
--
Ekrem Önsoy
"traceable1 " <thham...@gmail .comwrote in message
news:11******** *************@y 27g2000pre.goog legroups.com...
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!- Hide quoted text -
- Show quoted text -


On Oct 18, 3:56 pm, Steve215 <stephen.mer... @comcast.netwro te:
On Oct 18, 11:50 am, traceable1 <thham...@gmail .comwrote:
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!

This link describes the use of 'Automatic Execution Stored Procedures'
than may fit the bill for what you are looking for.

http://msdn2.microsoft.com/en-us/library/ms191129.aspx

Oct 18 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1435
by: Stephen | last post by:
I have code which checks whether a datagrid is empty and if it is it shows a panel on my page. If its not empty then Im using the server.transfer to go to another page so as im able to use the items in an array list. My problem is that I also have had to incorporate some Javascript to see whether the user is ok with moving forward. Everything is fine and works apart from when the user clicks cancel on the pop-up Internet Explorer window it...
6
8895
by: Hemant Shah | last post by:
Folks, I need to move HOME directory of an instance to another directory. What is the best way of doing it? Is changing password file enough? or dies DB2 store this info in it's own config? I am running UDB 8.2 on Linux and AIX. Thanks.
2
4919
by: Cheng Wei-Chao | last post by:
hi: i have a button, when i click it i want to store data to database and open a new window in general we use java script to open new window but how to call java script function after i executived the server side code thank you!
8
1671
by: Fabrizio Cyber | last post by:
Hi all, I want to use a .js into a visual basic project. How can I do it ? I've tried to open the script code into my project....and then ??? I see the code but I don't jnow how to make it interact with the vb program. Every kind of help is well accepted. Thank you .
10
2991
by: Bernie Hunt | last post by:
This is probably a silly question, but I've gotten myself confused. My app has two forms, form1 and form2. form1 is the start up object in the propers. An event in form1 instantiates form2. Dim myForm as HardwareStore myForm = New HardwareStore myForm.Show() I understand that my form2 can be referenced by
0
3982
by: Stealth3si | last post by:
I hope this is the right thread /forum to place this topic in. I'm trying to execute a .vbs file (double-click) on Windows 2000 Advanced Server with Service Pack 4 (on administrator account) and it gives me this startup error: Here is the entire contents (code) of the .vbs file when viewed via Notepad: (line by line)
2
1483
by: Slawek | last post by:
I would like to run a script at startup under SuSE 9. I read and figured out that it can be done using chkconfig and setting the proper run level. The problem I have currently is that I depend on system environmental variables being available for PHP. I am using PHP as a scripting language (nothing to do with the web), and this PHP script is called from the start up bash script, but it cannot retrieve any environmental vars at runlevel...
2
4593
by: jcor | last post by:
Hi, I'm running Ubuntu 7.04. I Have a perl script. I want it to be running all the time. The way it is working, I must start my script, so when someone turns off the computer it doesn't run anymore. I'd like it to start running when the computer boots. I read something about it in the web and I tried to add the script to /etc/init.d but didn't work. I need this to run in the shell. Can someone help me? TIA,
5
4018
by: rpelletier | last post by:
Good morning....As you will see when you view the script I am fairly new to Java. All I am trying to accomplish with this script is to navigate to the static URL listed in the script, however, one of the parameters in the URL requires the "Contact_Phone" variable which I pass to the script at runtime as a telephone number similar to the following; "Siebel_Query_With_ANI.html 813466XXXX" All the logic works great if I enter the phone number...
0
7874
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8368
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8231
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5404
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1205
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.