Is there any simple way to run same sql script on multiple remote sql server databases at once?

i am using sql server 2005. our company has many branches. each branch is located in different country. so when i update database in any country over the VPN connection then i need to update db in another country one by one over the vpn connection. it
is very tire some job....so i was think that there could be any easy trick to update multiple db in different country easily. so am developing a store procedure which will connect each DB in different database one after one over the vpn and read script from
sql file and execute the script in remote db over vpn. so please have look at my script and tell me how to do it. please do not advise me to use any 3rd party.
here is a table structure where i will put all my remote db details.
CREATE TABLE [dbo].[DBDetails]
[ServerName] [varchar](max)     NULL,
[DBName] [varchar](max)         NULL,
[UserID] [varchar](max)         NULL,
[Password] [varchar](max)       NULL,
[CountryCode] [varchar](2)      NULL
SET NOCOUNT ON
DECLARE DB CURSOR FOR SELECT ServerName,DBName,UserID,Password,CountryCode FROM    DBDetails
OPEN DB
DECLARE @ServerName     varchar(MAX)
DECLARE @DBName         varchar(MAX)
DECLARE @UserID         varchar(MAX)
DECLARE @Password       varchar(MAX)
DECLARE @CountryCode    varchar(2)
FETCH NEXT FROM DB INTO @ServerName,@DBName,@UserID,@Password,@CountryCode
WHILE @@FETCH_STATUS = 0
BEGIN
-- here i need some help for opening db connection and read sql file and execute  the statement
-- Please help here
FETCH NEXT FROM DB INTO @ServerName,@DBName,@UserID,@Password,@CountryCode
 END
 CLOSE DB
 DEALLOCATE DB
thanks

One way: set them as jobs and assign the same schedule or start them from a stored procedure:
http://www.sqlusa.com/bestpractices2005/startjobfromstoredproc/
Note: when you start a job from a stored procedure, control proceeds to the next statement, there is no wait for the job to finish.
Kalman Toth SQL SERVER 2012 & BI TRAINING
New Book: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2012

Similar Messages

  • IS THERE ANY SIMPLE WAY TO RETURN SPEED PERFORMANCE TO FACTORY SPEED AFTER ABOUT 3 YEARS OF RELATIVELY STANDARD USE?

    Everyone is often so quick to bash all these 'cleaning' utilities but rarely give any solutions.
    There's a lot of critiques and endless lists of what NOT to do to avoid performance problems.
    My Powerbook is 3 years old. It runs like molasses... SLOW.
    I'm not a computer geek, but I'm smart and understand quite a bit more than a newbie.
    Do I need a degree in computer engineering to fix/speed up my mac?
    Yes, I know, the cleaning utilities suck. But is it really true of all of them?
    I'm not totally convinced because there seems to be such a huge market for them.
    Sure, there's a huge market for bottled water too, so maybe they are just useless/marketing crap, but I really want to return to my original speed performance quickly and can't seem to find out if it's possible with a utility.
    I'm not willing to sit down for 3 hours and study line by line b.s. about how to fix it.
    I have no problem if it's not fixable. I've always assumed operating systems outgrow their hardware's capacity to keep up, and sell my old one for a new one, no prob.
    I don't care, really, but again, I'm curious if there is any quick, easy, user-friendly utility or method that I can use to return the speed performance I had as recently as a year ago? (I'd be satisfied with that).
    Anyone willing to bite on that? Anyone willing to not critique, complain, tell me what NOT to do and actually know a solution?
    IS THERE ANY SIMPLE WAY TO RETURN SPEED PERFORMANCE BACK TO (OR CLOSE TO) ORIGINAL FACTORY SPEED AFTER ABOUT 3 YEARS OF RELATIVELY STANDARD USE?
    The only thing I may have done outside of the norm was some video editing, but very little.

    Look for solutions here:
    https://discussions.apple.com/docs/DOC-3521
    https://discussions.apple.com/docs/DOC-3353
    Ciao.

  • Is there any simple way to close a group of PO's?

    Hello All,
    I was looking an answer for my question on forum but didn't found anything which could help me to solve my issue.
    I would like to close a group of PO's in some period of dates. Is there any simple way to do this? I mean transaction for example, which will let me to choose company number, period of dates  or range of PO numbers and close them by one tick (one action).
    Thank you in advance for any support from your site.
    Regards,
    Kamil

    Kamil,
    Though I have not used this functionality, can you check whether you can use this functionality for mass change?
    Upload and Download of Purchasing Documents
    http://help.sap.com/saphelp_srm70/helpdata/en/09/1f42188473402a890183fd1b7c6082/frameset.htm
    Using this function, you can download purchasing documents as a file to your PC, process them locally, and then upload the changed documents to the SAP Supplier Relationship Management (SAP SRM) system. You can download the following purchasing documents :
    Features:
    The upload/download supports the following functions and possible uses:
    - Cross-Document File Structure
    You can display and process the data in a standard tabular file structure for the documents named above. The file structure assigns a unique technical ID to each data field in a metadata area.
    - Process Document Data Offline and Retain
    You can change or delete existing data, add new data, and transfer all document data, for example, customer fields.
    - Process Large Documents
    This function simplifies the creation of documents with numerous items, and simplifies mass changes to large documents; for example, you can download a document with only one item, and add multiple items to it offline.
    Background processing occurs in the case of very large documents.
    Regards,
    Sandeep

  • Is there any simple way to create ods files (OpenOffice Calc)?

    Is there any simple way to create ods files (OpenOffice Calc) using ResultSet (from java.sql)?

    Mabe, you can create CVS files (plain text) Ej...
    ====test.cvs=====
    1, "aaa"
    2, "bbb"
    3, "ccc"
    ===============
    Using a "BufferedWriter"

  • Is there any simple way to find items in the library that are missing?

    That is, library entries that point to a missing file?
    Thanks, MZ

    I think you'll find definitions of simple vary...
    FWIW iTunes Folder Watch doesn't modify anything unless you ask it to. iTunes creates an XML file which can by quizzed by 3rd party apps. One of the features of iTFW is to read this file and scan your folders to confirm that each file referenced exists. You can review the list of dead tracks and decide what to do, e.g. manually remove them from iTunes, restore from a backup etc.
    That said there is an iTunes only solution to your question:
    1. Create an empty playlist called "Found".
    2. Select the Music source, use CTRL-A to select all items.
    3. Drag this selection onto the "Found" playlist and wait with your mouse button held down while iTunes counts how many items there are. Release when iTunes catches up with you.
    4. Create a new Smart Playlist called "Not Found". Rules are *Playlist is Music* and *Playlist is not Found*.
    Any files with broken links won't have been copied into the manual playlist and hence will be "Not Found".
    Going back to the original discrepancy between numbers of tracks in iTunes & on your iPod it's also worth noting that it is sometimes possible to create more than one library entry to the same physical file. In this instance only one file is ever copied to the iPod. This can also trigger files that sync on every connection. iTunes & iPod may also count music videos differently.
    Lastly, I think the "The iPod cannot be resynched. The required file cannot be found" error is not related to media files that might be missing but more to do with iTunes having trouble accessing the iPod itself.
    tt2

  • Is there any possible way to run PPC applications on Mountain Lion?

    THrough any kind of emulation or something?

    ds store wrote:
    There is a hack over at MacRumors.com with MichealLAX that can get Snow Leopard/Server to run in a virtual machine.
    http://forums.macrumors.com/showthread.php?t=1365439
    If you need more performance for like games and such
    As you are an avid proponent and continuous user of Snow Leopard, I thank you, on behalf of all those current and future users of versions of OS X beyond Snow Leopard for the knowledge that these users have an additional tool in their toolbox: that is installing Snow Leopard into Parallels so as to be able to continue to access Rosetta for running their PowerPC apps.
    As you point out, if their hardware is old enough, an additional solution is the "dual-boot" method of installing SL into a new partition on their hard drive or an external hard drive. 
    However for those who have more modern Mac models, and have an absolute need to run their PowerPC software (that is, because no updated version of the software is available, no alternative software exists that can open their data files and/or they have financial considerations that may updates prohibititive at this time), using Snow Leopard in virtualization is the only method available to them on their new Mac.
    On the "performance" issue: keep in mind that running older PPC software in virtualization on newer, more powerful Intel Macs have been shown in most cases to run actually faster than the original software ran on a PowerPC Mac.
    Lastly, while installation of Snow Leopard client requires adjustments that could be denominated a "hack," all of the virtualization companies, including Parallels, support the easy installation of Snow Leopard Server without resorting to jumping through any hoops!
    My thread on MacRumors, linked above, offers instruction on both methods.
    Now that Apple has dropped the price on Snow Leopard Server by 95%, I always recommend purchasing SLS in the first instance.

  • Is there any simple way I can find out whether my router or my mac air is responsible for dropping internet connection constantly?  Often when I do the network diagnostic, the wifi light is green, but isp internet and server are either amber or red.

    This is driving me crazy.  The router (it came with the apartment) is a Fritz!Box fon Wlan 7240.  I would be willing to buy an new airport if that would fix it.  But in this country (Germany) you probably can't give things back. 

    This is not an alternative to Susan Howard's diagnostic questions, only an atempt to collect more data about your situation.
    Do you have the instruction manual for your router? I ask because at some point it might be a good idea to reset the router. Turning it off for about 15 seconds then turning it back on helps sometimes. The more basic procedure (this is with my router) is to push the reset. But that would mean you have to re-configure the router with password etc. from scratch.

  • Why is there no simple way to delete unused reference pages from multiple FM files?

    I have hundreds of files in which some, but not all, of the reference pages are not being used. I don't want to open each file and manually click each page and then delete the pages one by one... what can I do to fix this? I think the files were all created with the same template but ironically the author imported graphics (by reference) onto the reference pages. The path to the referenced graphics (which are located on the reference pages) is invalid, and now all the FM files have errors. I am not a framemaker master, so this may be a simple fix, but I can't figure it out. I tried opening a file (file A) and deleting the unused reference pages. Then I saved it as a new file name (file B) and tried to import the reference pages of "file B" into "file A". This did not work. It just added additional reference pages to file A. I just want to be able to generate a list of reference pages for the files and then only delete the ones that I don't need. Please help. Any suggestions???

    IF the imported graphics are still being used, then when you open a file with a "missing" graphic,  FM does ask where the missing file(s) is located and will use this information when searching for other missing graphics in other files of  book. You could try creating a temporary superbook that contains many of the files and then doing an update. Otherwise, deleting "unused" Reference pages doesn't really gain you anything (and you could potentially mess up some paratags if they are using any of the reference frames on any of those pages).
    When you import formats into FM files from another, FM uses and additive model, i.e. identically named objects are replaced and new ones are added. Nothing is removed.

  • Run a plsql script that is stored in a database in forms

    Hi there is it possible to run a plsql script that is stored in a database as a CLOB with parameter placeholders that will be replaced with the contents that will be inserted in a form? If it's possible how do I do this?
    Regards

    I don't think you can pass a parameter in Francois' example. You probably need a wrapper procedure as explaind by W1zard. So, the question pops up: why can't you create a stored procedure instead of an anonymous block in a clob column? If you do need it, it could look something like:
    Code in the table:
    begin
      insert into emp(empno,ename)
      values (:1, :2);
    end; 
    {code}Wrapper procedure:
    {code:java}
    create or replace procedure call_script(i_empno in number, i_ename in varchar2) as
      v_stmt   varchar2(32000);  -- CLOB is not possible, because execute immediate cannot use it.
    begin
      select replace(script_code,chr(13),chr(10)) 
      into   v_stmt
      from   script_table
      where  script_id = 1;
      execute immediate v_stmt using i_empno, i_ename
    end; 
    {code}
    Edited by: Ino Laurensse on Jan 22, 2009 10:52 AM
    Edited by: Ino Laurensse on Jan 22, 2009 10:58 AM
    (forum had some problems. Old code was posted first)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • HT4623 I have an iPod touch 2nd gen running ios 4.2.1 and i can't update it cuz theres no 'software update' in my settings. pls help. is there any other way i can update my iPod?

    I have an iPod touch 2nd gen running ios 4.2.1 and i can't update it cuz theres no 'software update' in my settings. pls help. is there any other way i can update my iPod?

    No more updates for the 2nd Gen.
    zyrako wrote:
    I have an iPod touch 2nd gen running ios 4.2.1 ...
    That is as far as your iPod will go.

  • TS3212 Apple appear to have an incorrect version of my email(one letter too many) I have tried many times but there does not seem to be any simple way of correcting this. I have now given them a new hotmail address to enable me to use the apps. Ive update

    Problem as outlined above now changed to using a new hotmail address but this address appears to preclude access to my existing itunes purchased library content?
    Are there any simple solutions to these problems?

    You can not merge accounts.
    Apps are tied to the Apple ID used to download them, you can not transfer them.

  • Is there any other way to  limit the data a user can see

    We are using Discoverer 10.2.xxx
    We are running it against an Oracle applications database but we do not have Discoverer integrated with the apps. I have created database users for discoverer and granted access to the data at the db level.
    We have about 40 salesreps and we only want each rep to see their own data. We have a high turn over with the reps
    For now, I have created the row level security in that folder in my eul. If the username = XXXX then Salesrep = XXXXX
    OR
    If username = YYYY then DSM = YYYY
    etc.. This goes on for about 40 users We have 3 levels of "users" - Salesrep, DSM or RSM (District or Region sales manager)
    These users are setup in my apps and I can write a database procedure to select their salesrep name based on their username.
    Is there any other way to limit the data that the salesreps can see ?
    Possibly with a stored procedure some way?
    Thanks
    Angie

    At a previous client's, I had created a system not too unlike what you're describing.
    Basically, I created an Oracle table that stored information concerning the salesperson as in Oracle Apps the data was not reliable for what they were doing (ie: with adding Apps modules, sometimes salesperson data was there, but with say, CRM, it was in another place, etc.).
    So, since this table was going to be used for driving everything about a salesperson (commissions, who they report to, when they started, territory, when / if they moved territories and/or manager, etc, etc.) I put lots of good stuff in it that would make life easier for them.
    The end user in charge of all this had was given a Form to add, edit, delete all this good stuff and they were happy.
    When it came time for security, it worked like a charm in that I used the concept of the BIS views where a user has an apps id associated to them and all data was filtered by that id. All I really had to do was to create this view that simply filtered data to that user's id. Then whenever I had a Discoverer report for salespeople, managers, etc. I just made sure the folder used had a join to this filtering view and I chose an item from the filtering view and all worked fine. All Discoverer reports only returned row level information for the salesperson who ran it.
    Likewise, the same Oracle table was queried by another security view that only brought back the same IDs for the salespeople associated to each manager. When this simple view was joined to any sales Discoverer folder (and used in Disco), it limited all data to the salespeople the manager was responsible for.
    Obviously this is just an overview and would take pages to explain, but essentially, if you can associate some kind of unique ID to each salesperson (I used the one returned in BIS views when someone logs into Apps, but you could just assign a different in your case), then you can create a view that filters to that id. Then when that view is brought into the EUL and joined to any other folder in the sales area (and you choose a column from the security view), you'll have what you're referring to - row level security for all salespeople and managers.
    When it works - it sure does look impressive.
    Russ

  • Any simple way to do popup image view overlay in DW? Can't get pickachoose+fancybox+fluid working

    Hey all,
    Just wondering if anyone knows any simple ways to create a popup over lay window like what fancybox/lightbox/shadow box does and get it to work with a Dreamwever fluid grid site?
    I've got pikachoose+fancy box to run together perfectly in a plain html page, but when I bring that code into a Dreamweaver fluid grid site, the code doesn't work (well images don't cycle, and popover doesnt load when you click on the image link).
    I'm guessing it's a jquery conflict of some kind.
    Any help would be great, I can post the full code if someone is able to take a look. When I inspect the code in Google Chrome web inspector I get in the console:
    Uncaught TypeError: Cannot read property 'msie' of undefined jquery.fancybox-1.3.4.pack.js:18
    Uncaught TypeError: Object [object Object] has no method 'fancybox'
    Code below
    <!doctype html>
    <html class="">
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>-</title>
    <link href="boilerplate.css" rel="stylesheet" type="text/css">
    <link href="css/ce4.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="jquery.fancybox-1.3.4.css" media="screen" />
    <link type="text/css" href="styles/bottom.css" rel="stylesheet" />
    <script src="respond.min.js"></script>
    <script type="text/javascript" src=" https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <script type="text/javascript" src="lib/jquery.pikachoose.js"></script>
    <script type="text/javascript" src="jquery.fancybox-1.3.4.pack.js"></script>
    <script language="javascript">
    $(document).ready(function (){
    var a = function(self){
    self.anchor.fancybox();
    $("#pikame").PikaChoose({hoverPause:true,  showCaption:false, text: {previous: "", next: "" }, buildFinished:a});
    </script>
    </head>
    <body>
    <div class="pikachoose">
    <ul id="pikame" >
    <!-- <li><a href="1.jpg"><img src="1.jpg"></a>-->   
    <li>
    <a href="images/1large.jpg">
    <img src="images/1small.jpg"/>
    </a>
    <span></span></li>
    etc... etc...
    Any help would be great

    I don't know what a pikachoose is, but Fancybox2 works in Fluid Layouts.  Copy & paste the following code into a new, blank document.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>HTML5, with Fancybox2 Viewer</title>
    <!--LATEST JQUERY CORE LIBRARY-->
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <!--FANCYBOX plugins-->
    <link href="http://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.css" rel="stylesheet" media="screen">
    <script src="http://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.pack.js"></script>
    <style>
    /**this styles image container**/
    #thumbs p {
    float:left;
    width: 180px;
    height: 12.5em;
    margin: 10px 0 0 20px;
    padding: 10px;
    border: 1px solid silver;
    /**rounded borders**/
    -moz-border-radius: 20px;
    -webkit-border-radius:20px;
    border-radius: 20px;
    /**this styles caption text**/
    font: italic 14px/1.5 Geneva, Arial, Helvetica, sans-serif;
    color: #666;
    text-align:center;
    /**recommend using same size images**/
    #thumbs img {
    width:  160px; /**adjust width to thumbnail**/
    height: 120px; /**adjust height to thumbnail**/
    margin-bottom: 1.5em;
    opacity: 0.75;
    #thumbs img:hover {opacity: 1.0}
    /**float clearing**/
    #thumbs:after {
    content:".";
    clear:left;
    font-size:0px;
    line-height:0;
    display:block;
    visibility:hidden;
    </style>
    </head>
    <body>
    <h1><a href="http://fancyapps.com/fancybox/">Fancybox2</a> Viewer with images</h1>
    <!--insert thumbnails with links to full size images below-->
    <div id="thumbs">
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 1" /></a> <br />
    Caption 1
    </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 2" /></a> <br />
    Caption 2
    </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 3" /></a> <br />
    Caption 3
    </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 4" /></a> <br />
    Caption 4
    </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120" alt="Thumbnail 5" /></a> <br />
    Caption 5
    </p>
    <!--end thumbs--></div>
    <!--FancyBox function code-->
    <script>
    $(document).ready(function() {
         $('.fancybox).fancybox();
    </script>
    </body>
    </html>
    Nancy O.

  • HT3697 Is there a simple way to create a borderless PDF from Keynote.

    Is there a simple way to create a "borderless" PDF using Keynote slides?
    When I create a PDF, each slide appears separately with a border around it.
    I am a relatively new keynote and mac user.
    I am using Keynote version 6.2

    I got the same result.
    I'm trying to create what looks like a single document that viewers can scroll through.
    I done quite a bit of checking and it seems that Keynote used to give you the ability to crop the PDF which, if I understand what they are talking about, would make it look like one big document and not a series of slides.
    I read about using terminal commands (?) which are way beyond my skill level.
    Also, I could buy Adobe Acrobat which, from what I've read, would also work. I'm not fond of making that investment.
    Right now, I'm stuck!
    I need to create a "long form sales letter" and I'm starting to think that I'm using the wrong program.
    Thank you very much for your help and any other suggestions you might have.

  • I am developing a flex web application which needs to access Other domain ,is there any other way other than cross domain policy available ? please help

    i am developing a flex web application which needs to access Other domain (Payment Gateway API),is there any other way other than cross domain policy available ? please help.
    we donot have access other domain thats why we want other solution..

    All the paths to CFCs are the same in my live production site.  Can you be more specific as to what you mean by "RemoteClass aliases in your AS Classes and CFCs (if any) are correct."?  How will the app know that the CFC is on http://myLiveSite.com instead of http://myDevSite.com?  The only line of code that I have noticed that points to a URL is the endpoint in a file called _Super_XXX.as.  And at the top of that file it says that the file is not meant for editting.
    To clarify...I see your app/code all exists on a server access via a web browser so I can understand that everything still works when deployed.  Mine is a mobile app so when I am developing and testing on my local computer the URL points to my local development machine.  However when I deploy it to a mobile device like a tablet and run the app, it needs to be able to access a cfc on a remote server via a different URL ie. my http://myLiveSite.com/myCFC.cfc instead of http://localhost/myCFC.cfc
    Thanks for your help!  I will now take a look at your thread.
    Message was edited by: ace0215

Maybe you are looking for