Script out all linked servers. Is it possible?

Hi All,
Is there any query available for scripting out all linked servers which can be used while migrating from one sql instance to another sql instance? We have like 40 odd linked servers which has to be scripted out and moved to new server.
We are doing migration from sql server 2008 r2 to sql 2014.
Thanks in Advance.

Hello,
Try the following resource.
http://www.sqlservercentral.com/scripts/Miscellaneous/30620/ 
http://sev17.com/2010/07/06/scripting-linked-servers/
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com

Similar Messages

  • Script: Open all linked docs in *new* window

    Can anybody help? I have a pdf document that will need to have 2000+ links to other documents...and I need to have each link open in a *new* window (by default, they open in the exisitng window). We obviously don't want to have to individually set each link's Properties to "open in new window"...
    Is there a script I can add to the main (parent) pdf doc to make this happen for all links the user clicks on from the main doc? The kicker is that we can't expect the end user to be able to fool with the Preferences or anything like that...in addition, we assume the user may be viewing in either Acrobat or Acrobat Reader in the corporate environment.
    Alternately, a script to automatically show the "previous view" and "next view" arrows, without having the user have to do anything, might work. The absence of those arrows in the default view (starting w Acro 8?) is why we've had to go with the "open in new window" idea. We are dealing with non-tech-savvy users, so we don't want them to have to know keyboard shortcuts or set Preferences...
    Thanks so much!!!
    Bradford

    Absolutely, thanks! I will try to create a variable to store -- and later, restore -- that. Since we have about a zillion links, changing each link would be no fun at all! Is there an issue with trying to evaluate the setting and store the variable from a "on page 1 open" action, and being able to access the variable's value from the "DocumentWillClose" action? (and apologies for any capitalization, etc., issues)
    Do I somehow need to declare the variable to be global, or do I need to have the initial actions happen from an "on document open" event? (I don't see such an event as being an available option)...
    Any code snippet(s) far a similar situation that you could point me towards...?
    Thanks!
    Bradford

  • How can a script access all link properties?

    I'm really glad to find this pool of expertise out in the cloud. TIA for all replies.
    I'm looking for proper syntax to access the more detailed properties of graphic file links, such as the page# on which they appear and effective PPI. These are visible in the link window, but I cannot find them in the ESTK for CS4 Object Model Viewer. There is are name, filePath, and linkType, which are all very useful and also visible in the link window. But as for the other info I see only a suggestive attribute called "properties" which is itself an object, and I cannot seem to query its contents.
    As I'm very, very new to scripting the cause could be little more than my own ignorance.
    Is there a way to convert and object to strings so I can see how it is built?
    In case anyone is interested, I'm trying to amplify a very helpful little script written three years ago by Steve Wareham:
    // ====== ListLinks ====== \\
    /* This is a JavaScript for InDesign. It will create a new text box on the first page of your document, and list all the links used in your document.
    A dialog box provides options to list the links names, files paths, and file types. Created by Steve Wareham 5/08/2007
    attempts to amplify with addition of Page and Effective PPP by Marc Shargel May 2010 */
    // ----- Dialog Box ------\\
    var myDialog = app.dialogs.add({name:"Link Lister", canCancel:true});
    with(myDialog){
    with(dialogColumns.add()){
    with(borderPanels.add()){
    with(borderPanels.add()){
    staticTexts.add({staticLabel:"What link information do you want? "});
    with(dialogColumns.add()){
    with(borderPanels.add()){
    var my1RadioButton = checkboxControls.add({staticLabel:"Names", checkedState:true});
    var my2RadioButton = checkboxControls.add({staticLabel:"Paths"});
    var my3RadioButton = checkboxControls.add({staticLabel:"File type"});
    var my4RadioButton = checkboxControls.add({staticLabel:"Page"});
    var my5RadioButton = checkboxControls.add({staticLabel:"Effective PPI"});
    // extending the dialogue box was easy...
    // ----- End of Dialog Box ----- \\
    //----- Begin ----- \\
    if(myDialog.show() == true){
    var myDocument = app.activeDocument;
    var totalLinks = myDocument.links.length;
    var myNewTextFrame = myDocument.textFrames.add() // Add a text frame to display the list of links
    myNewTextFrame.geometricBounds = [ "0p0", "0p0", "50p5", "50p5"];
    for ( i = 0;  i < totalLinks;  i++ )
    if (my1RadioButton.checkedState == true) {
    myNewTextFrame.contents = ( myNewTextFrame.contents + "File: " + myDocument.links.item(i).name );
    if (my1RadioButton.checkedState == true) {
    myNewTextFrame.contents = ( myNewTextFrame.contents + " Path: " + myDocument.links.item(i).filePath );
    if (my3RadioButton.checkedState == true) {
    myNewTextFrame.contents = ( myNewTextFrame.contents + " Type: " + myDocument.links.item(i).linkType );
    //... but the following lines do not work. I can refer to "myDocument.links.item(i).properties" but it is reported as an object.
    //if (my4RadioButton.checkedState == true) {
    //myNewTextFrame.contents = ( myNewTextFrame.contents + " Page#: " + myDocument.links.item(i).page );
    //if (my5RadioButton.checkedState == true) {
    // myNewTextFrame.contents = ( myNewTextFrame.contents + " PPI: " + myDocument.links.item(i).effectivePPI );
    myNewTextFrame.contents = ( myNewTextFrame.contents + '\r' );
    myDialog.destroy();

    Is there a way to convert and object to strings so I can see how it is built?
    Whoops, I'd meant to answer this. Sure, you can just loop over the object. For instance, since you were curious about the "properties" member, suppose we wanted to look at the individual members of the properties object of a link.
    Just type in the JavaScript console:
    { var p = app.activeDocument.links[0].properties; for (var i in p) $.writeln(i + "\t"+p[i]); }
    which produces:
    versionState     1986221653
    editingState     1986217301
    linkXmp     [object LinkMetadata]
    index     0
    parent     [object Image]
    assetURL    
    assetEtag    
    assetID    
    edited     false
    name     yeti.png
    needed     true
    status     1852797549
    linkType     Portable Network Graphics (PNG)
    date     Mon May 24 2010 15:36:52 GMT-0400
    size     113083
    filePath     Hermann Zapf:Users:writer:Desktop:yeti.png
    id     209
    label
    You'll note that these are all the same members that the links[0] object itself has. Again, "properties" is just a convenience for setting more than one at once. So compare the output to:
    { var p =  app.activeDocument.links[0]; for (var i in p) $.writeln(i +  "\t"+p[i]); }
    How does that work? Well, the syntax "for (i in p)" calls the for loop once for every member of the Object p, and then we print out the name of each member along with its value.
    (I guess the good JavaScript programmers would encourage you to put {}'s around the $.writeln, and the really anal people would remind you that JavaScript does not have block scope* and therefore you should wrap the whole thing in:
    "function(){ ... }()".
    (*:reference is to Javascript: The Good Parts; Awful Parts, a book (well, chapter thereof) well worth reading.))

  • Ok, taking the leap. Tossing out all Windows servers and going with Lion Server only!

    Help! We are retiring our Windows 2000 server (finally) and going with Lion Server only. We are transitioning from Windows to Mac and have 30 PC's running XP and a few scattered Windows 7 PC's (Lab). We have teachers and staff using Mac computers. Can I authenticate my windows pc's to Lion server?

    1. We are running lion on the old Xservs because we had them. Thought they still would be good file servers. And we thought Lion would work on them but know that mountain lion will not
    2. We have looked up some errors and they have to do with spotlight not getting index finnished with all the adobe files in folders, subfolders and subsubfolders. The vnode errors have something to do with lots ofmopen files but we do not know why. Maybe all these many directiries of files in deep hierarchy of adobe CS which the department does shared work directly on the server is issue. We have tried to get them tomuse as archive only but they do not habe a clue how to do shared work on separate clients. This deparment is not very savy in use but imtense Adobe CS users and my concern is these old file servers cannot take this kind of use.?
    Imposted the logs because i have no clue to why they keep filling up (the vnodes).

  • How to script out linked in servers from sql 7.0

    Can someone help me with the syntax of scripting out the linked server. Thanks

    Hi Suresh,
    In addition to other post, you can use the detailed T-SQL scripts below to script out all linked and remote servers on SQL 7.0.
    --Script to script out all linked/remote servers
    --Works on 7.0 and 2000 servers
    --remote password decrypt only works on 7.0
    declare
    @status smallint, -- server status
    @server sysname, -- server name
    @srvid smallint, -- server id
    @srvproduct nvarchar(128), -- product name (dflt to ss)
    @allsetopt int, --sum of all settable options
    @provider nvarchar(128), -- oledb provider name
    @datasrc nvarchar(4000), -- oledb datasource property
    @location nvarchar(4000), -- oledb location property
    @provstr nvarchar(4000), -- oledb provider-string property
    @catalog sysname, -- oledb catalog property
    @netname varchar(30), -- Server net name
    @srvoption varchar(30), -- server options
    @loclogin varchar(30), -- Local user
    @rmtlogin varchar(30), -- Remote user
    @selfstatus smallint, -- linked server login status
    @rmtpass varbinary(256), -- linked server login password
    @pwdtext nvarchar(128), -- linked server decrypted password
    @i int, -- linked server pswd decrypt var
    @lsb tinyint, -- linked server pswd decrypt var
    @msb tinyint, -- linked server pswd decrypt var
    @tmp varbinary(256) -- linked server pswd decrypt var
    select @allsetopt=number from master.dbo.spt_values
    where type = 'A' and name = 'ALL SETTABLE OPTIONS' -- Only 7.0 else use 4063
    declare d cursor for SELECT srvid,srvstatus, srvname, srvproduct, providername, datasource,
    location, providerstring, catalog, srvnetname
    from master..sysservers
    where srvid > 0 -- Local Server
    open d
    fetch next from d into @srvid, @status, @server, @srvproduct, @provider, @datasrc,
    @location, @provstr, @catalog, @netname
    SET NOCOUNT ON
    while (@@FETCH_STATUS<>-1) begin
    PRINT '--------------------------------'
    Print '-- ' + @server
    PRINT '--------------------------------'
    If @status in (64,65) --Remote Server
    Begin
    Print 'sp_addserver'
    Print ' @server = '''+ @server + ''''
    Print ' GO'
    If @status = 64
    Begin
    Print 'sp_serveroption'
    Print ' @server = '''+ @server + ''','
    Print ' @optname = ''rpc'','
    Print ' @optvalue = ''false'''
    Print ' GO'
    End
    exec ('declare r cursor for
    select l.name, r.remoteusername from
    sysremotelogins r join sysservers s on
    r.remoteserverid = s.srvid
    join syslogins l on
    r.sid = l.sid
    where s.srvname = '''+ @server + '''')
    open r
    fetch next from r into @loclogin, @rmtlogin
    while (@@FETCH_STATUS<>-1)
    begin
    Print 'sp_addremotelogin'
    Print ' @remoteserver = '''+ @server + ''','
    Print ' @loginame = '''+ @loclogin + ''','
    Print ' @remotename = '''+ @rmtlogin + ''''
    Print ' GO'
    fetch next from r into @loclogin, @rmtlogin
    end
    close r
    deallocate r
    End
    Else --Linked server
    Begin
    If exists (select * from tempdb..sysobjects where name like '#tmpsrvoption%')
    Begin
    drop table #tmpsrvoption
    End
    Create Table #tmpsrvoption
    srvoption varchar(30)
    insert #tmpsrvoption
    select v.name
    from master.dbo.spt_values v, master.dbo.sysservers s
    where srvid = @srvid
    and (v.number & s.srvstatus)=v.number
    and (v.number & isnull(@allsetopt,4063)) <> 0
    and v.number not in (-1, isnull(@allsetopt,4063))
    and v.type = 'A'
    PRINT 'sp_addlinkedserver'
    Print ' @server = '''+ @server + ''''
    Print ', @srvproduct = ''' + @srvproduct + ''''
    If @srvproduct <> 'SQL Server' --Cannot specify additional info for SQL Server Product
    Begin
    Print ', @provider = ''' + @provider + ''''
    Print ', @datasrc = ''' + @datasrc + ''''
    Print ', @location = ''' + @location + ''''
    Print ', @provstr = ''' + @provstr + ''''
    Print ', @catalog = ''' + @catalog + ''''
    End
    Print ' GO'
    -- Set all servers options to false, then reset correct server options
    Print 'sp_serveroption'
    Print ' @server = '''+ @server + ''','
    Print ' @optname = ''rpc'','
    Print ' @optvalue = ''false'''
    Print ' GO'
    Print 'sp_serveroption'
    Print ' @server = '''+ @server + ''','
    Print ' @optname = ''rpc out'','
    Print ' @optvalue = ''false'''
    Print ' GO'
    Print 'sp_serveroption'
    Print ' @server = '''+ @server + ''','
    Print ' @optname = ''data access'','
    Print ' @optvalue = ''false'''
    Print ' GO'
    declare s cursor for SELECT srvoption
    from #tmpsrvoption
    open s
    fetch next from s into @srvoption
    while (@@FETCH_STATUS<>-1)
    begin
    Print 'sp_serveroption'
    Print ' @server = '''+ @server + ''','
    Print ' @optname = '''+ @srvoption + ''','
    Print ' @optvalue = ''true'''
    Print ' GO'
    fetch next from s into @srvoption
    End
    close s
    deallocate s
    --Script linked server logins
    If exists (select * from tempdb..sysobjects where name like '#tmplink%')
    Begin
    drop table #tmplink
    End
    create table #tmplink
    rmtserver sysname,
    loclogin sysname null,
    selfstatus smallint,
    rmtlogin sysname null
    insert #tmplink
    exec ('sp_helplinkedsrvlogin '''+ @server + '''')
    declare ll cursor for
    select loclogin, selfstatus, rmtlogin from #tmplink order by rmtlogin
    open ll
    fetch next from ll into @loclogin, @selfstatus, @rmtlogin
    while (@@FETCH_STATUS<>-1)
    begin
    -- Use self no remote user/password
    If (@selfstatus = 1 and @loclogin is null)
    Begin
    Print 'sp_addlinkedsrvlogin'
    Print ' @rmtsrvname = '''+ @server + ''','
    Print ' @useself = ''true'''
    Print ' GO'
    End
    Else
    If (@selfstatus = 1 and @loclogin is not null) Begin
    Print 'sp_addlinkedsrvlogin'
    Print ' @rmtsrvname = '''+ @server + ''','
    Print ' @useself = ''true'','
    Print ' @locallogin = '''+ @loclogin + ''','
    Print ' @rmtuser = NULL,'
    Print ' @rmtpassword = NULL'
    Print ' GO'
    End
    Else
    If (@selfstatus = 0 and @rmtlogin is null) Begin
    Print 'sp_addlinkedsrvlogin'
    Print ' @rmtsrvname = '''+ @server + ''','
    Print ' @useself = ''false'','
    Print ' @locallogin = NULL,'
    Print ' @rmtuser = NULL,'
    Print ' @rmtpassword = NULL'
    Print ' GO'
    End
    Else
    If (@selfstatus = 0) Begin -- Check for Use self mappings
    exec ('declare pwd cursor for
    select l.password from master..sysservers s
    join master..sysxlogins l on s.srvid = l.srvid --where l.sid is not null
    where s.srvname = '''+ @server + ''' and l.name = '''+ @rmtlogin + '''')
    -- Decrypt passwords
    -- Only works for 7.0 server
    -- Encrypt algorithm changed in 2000
    open pwd
    fetch next from pwd into @rmtpass
    while @@fetch_status = 0
    begin
    set @i = 0
    set @pwdtext = N''
    while @i < datalength(@rmtpass)
    begin
    set @tmp = encrypt(@pwdtext + nchar(0))
    set @lsb = convert(tinyint, substring(@tmp, @i + 1, 1))
    ^ convert(tinyint, substring(@rmtpass, @i + 1, 1))
    set @i = @i + 1
    set @tmp = encrypt(@pwdtext + nchar(@lsb))
    set @msb = convert(tinyint, substring(@tmp, @i + 1, 1))
    ^ convert(tinyint, substring(@rmtpass, @i + 1, 1))
    set @i = @i + 1
    set @pwdtext = @pwdtext + nchar(convert(smallint, @lsb)
    + 256 * convert(smallint, @msb))
    end
    Print 'sp_addlinkedsrvlogin'
    Print ' @rmtsrvname = '''+ @server + ''','
    Print ' @useself = ''false'','
    If (@loclogin is null)
    Begin
    Print ' @locallogin = NULL,'
    End
    Else
    Begin
    Print ' @locallogin = '''+ @loclogin + ''','
    End
    If (@rmtlogin is null)
    Begin
    Print ' @rmtuser = NULL,'
    End
    Else
    Begin
    Print ' @rmtuser = '''+ @rmtlogin + ''','
    End
    If (@pwdtext is null)
    Begin
    Print ' @rmtpassword = NULL'
    End
    Else
    Begin
    print ' @rmtpassword = '''+ @pwdtext + ''''
    End
    Print ' GO'
    fetch next from pwd into @rmtpass
    end
    close pwd
    deallocate pwd
    End
    fetch next from ll into @loclogin, @selfstatus, @rmtlogin
    End
    close ll
    deallocate ll
    End
    If @netname <> @server -- If the srvnetname.sysservers is different from srvname.sysservers
    Begin
    Print 'sp_setnetname'
    Print ' @server = '''+ @server + ''','
    Print ' @network_name = '''+ @netname + ''''
    End
    fetch next from d into @srvid,@status, @server, @srvproduct, @provider, @datasrc,
    @location, @provstr, @catalog, @netname
    End
    close d
    deallocate d
    Reference:
    http://www.sqlservercentral.com/scripts/Miscellaneous/30620/
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • Linked servers

    HI all,
    i am using oracle10g and operating syustem MS xp.I need to fetch the tables in oracle Db from the sql server 2005.i tried out by linked servers.but itz not working.i know itz not fair posting a question of issue in sql server.bt i would bre appreciate if any one help me in this.
    Thanks in advance

    Please post in the general database forum instead of here; SQL Developer is a tool.
    Anyway, you'd need Oracle's ODBC driver for connecting from third party apps.
    Regards,
    K.

  • Union All with Linked Servers - Works until loaded on to the report server then fails.

    Hi,
    On our production server I have 2 linked servers.  One that leads to ServiceNow via ODBC and one that leads to an HP Openview database.
    Testing these linked servers works fine.  I have a query that obtains info from each source and 'union all' together.  When i run this query in SQL Server management studio it works fine and I get info from both data sources union-ed together perfectly.
    I transfer this into Visual Studio and create a report, which again runs perfectly.
    I upload this report to the report server and try to run it and get the error: 
    An error has occurred during report processing. (rsProcessingAborted)
    Query execution failed for dataset 'Dataset1'. (rsErrorExecutingCommand)
    For more information about this error navigate to the report server on the local server machine, or enable remote errors
    When I rummage through the log files for the report server, I find very little helpful errors, basically this:
    ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Query execution failed for dataset 'Dataset1'. ---> System.Data.SqlClient.SqlException: Cannot
    execute the query.
    I did a test where I created a copy of the report and ran only he Servicenow  section of the report and it works, then ran only the HP section of the report and it works.  It seems the UNION ALL is the problem somehow. 
    Anyone have any ideas??
    Thanks
    Kirsty

    Hi Kirsty,
    As you posted, this issue is caused by the security configuration of Linked Server.
    Generally, in a domain environment, we can specify a domain account as the stored credentials for the report, and then configure the Linked Server to "Be made using the login’s current security context".
    However,if we specify a SQL Server login as the stored credentials for the report, please set the Linked Server security to "By using this security context", and then providing the necessary credentials to authenticate at the linked server.
    Please also add the Reporting Services Security role to the Linked Server Remote Server Login Mappings.
    For more information about Creating Linked Servers, please refer to
    http://msdn.microsoft.com/en-us/library/ff772782.aspx
    About Security for Linked Servers, please refer to
    http://msdn.microsoft.com/en-us/library/ms175537.aspx
    Regards,
    Swallow

  • I have just updated my 4s to IOS7. and now my battery discharge is significantly increase. With my Iphone fully charged, the battery run out within 6 hours without using the phone at all. Would it be possible to get the IOS 6.1.3 back to my 4S?

    I have just updated my 4s to IOS7. and now my battery discharge is significantly increase. With my Iphone fully charged, the battery run out within 6 hours without using the phone at all. Would it be possible to get the IOS 6.1.3 back to my 4S?

    Hi, thanks for the suggestion. I have tried as you suggested, and when opening the "purchased" apps some have the icloud logo next to them, but I only have "OPEN" against "Find My iPhone". When opening it up, it goes through the same routine; needs to be updated before proceeding, and wouldn't update because I don't have IOS8.
    Anything else I could try, or am I doomed!
    All of your help is much appreciated, thanks

  • My iPad was stolen in brazil.  i cannot get the manufacturer id number from my iPhone or my macbook air....they are all linked together though.  any suggestions on how and if i can possibly retrieve this and thus locate the device? thanks julie

    my iPad was stolen in brazil.  i cannot get the manufacturer id number from my iPhone or my macbook air....they are all linked together though.  any suggestions on how and if i can possibly retrieve this and thus locate the device? thanks julie

    Launch iTunes, go to the Preferences, select Devices, and hover your cursor over the backup file for the iPod. That should show you the serial number, IMEI, and possibly the MEID.
    The manufacturer ID will not help you locate the iPad, though. If you set up the Find My iPad service in the Settings prior to the iPad going missing, then there is a chance that can be tracked, though it depends on a number of factors (the iPad is turned on, connected to a WiFi or 3G network, and has not had the Find My iPad service disabled or the iPad been completely restored). 
    If you did not set up Find My iPad, then there is no way to track it. Contact the police and change any passwords for any online accounts you may have used from your iPad (the iTunes Store, for instance). 
    Regards.

  • Why would all out going mail servers saying offline ?

    If this has been covered before, sorry, I couldnt find it.
    All of my out going mail servers say off line. can you tell me why ?
    using M 10.9.2

    problem solved, had a problem with icloud.

  • UIX:train - possible to default all links to be enabled?

    Is there a way that I can default all of the links in a uix:train to be enabled, rather than just the next link after the selected Index? (selectedIndex+1)
    I tried using the disabled attribute and setting each link to disabled="false", but that doesn't work.
    <uix:train value="1" formName="PersonalInfoForm" formSubmitted="true" id="piTrain" >
    <uix:contents>
    <uix:link text="Account Search" />
    <uix:link text="Basic Account Detail" disabled="<%=disabledFlag%>" />
    <uix:link text="Distribution Detail" disabled="<%=disabledFlag%>" />
    <uix:link text="Data Permissions" disabled="<%=disabledFlag%>" />
    <uix:link text="Report Permissions" disabled="<%=disabledFlag%>" />
    </uix:contents>
    </uix:train>
    Thanks!
    -Teri Kemple

    You can see my answer to this in your dupicate posting here:
    UIX:train - how to make all links available/enabled

  • Is it possible to remove collapse all and expand all links in HGrid.

    Hi All,
    Is there any way to remove collapse all and expand all links which HGrid shows by default, the reason is when the user clicks on collapse all it will collapse to root node but my requirement is it should collapse untill 2 node level.
    Thanks
    Babu

    From the javadoc of OAHGridBean
    ======================
    void setExpandAllEnabled(boolean expandAllEnabled)
    Indicate whether the "Expand All" (and "Collapse All") links should be rendered for the HGridBean.
    Cheers,
    Ganesh

  • Some, not all, links not working on certain website. Links work in other browser. Any help out there?

    I cannot get the login links (either of them) or a couple of other links to work in firefox 3.6.13. Other links on this page work fine and all links work fine using chrome. This is the only page I am having this issue with, any help?

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • Script out many stored procedures at once?

    I found lots of methods for individually scripting out stored procedures, but I'd like to know if there's a way to do many (like 100 or so) at once.
    Ideally, I'd like to execute something that would save all the procedures that start with 'dev_' to the file system somewhere, then delete the dev_ SP's from the database and leave the other SPs that actually get used.
    Is that possible in one step?  Does any one have a link or an idea?
    Thanks in advance!!

    Actually, I did slight modifications after that - here is a version that really scripts them:
    set nocount on
    DECLARE @Test TABLE (Id INT IDENTITY(1,1), Code varchar(max))
    INSERT INTO @Test (Code)
    SELECT 'IF object_ID(N''[' + schema_name(schema_id) + '].[' + Name + ']'') IS NOT NULL
    DROP PROCEDURE ['+ schema_name(schema_id) +' ].[' + Name + ']' + char(13) + char(10) + 'GO' +
    OBJECT_DEFINITION(OBJECT_ID) + char(13) +char(10) + 'GO' + char(13) + char(10)
    from sys.procedures
    where is_ms_shipped = 0
    DECLARE @lnCurrent int, @lnMax int
    DECLARE @LongName varchar(max)
    SELECT @lnMax = MAX(Id) FROM @Test
    SET @lnCurrent = 1
    WHILE @lnCurrent <= @lnMax
    BEGIN
    SELECT @LongName = Code FROM @Test WHERE Id = @lnCurrent
    WHILE @LongName <> ''
    BEGIN
    print LEFT(@LongName,8000)
    SET @LongName = SUBSTRING(@LongName, 8001, LEN(@LongName))
    END
    SET @lnCurrent = @lnCurrent + 1
    END
    Premature optimization is the root of all evil in programming. (c) by Donald Knuth
    Naomi Nosonovsky, Sr. Programmer-Analyst
    My blog

  • Script out SSIS packages from SSISDB using powershell

    Hi,
    I was able to script out the packages that are on msdb but I was unable to script out that are in Integration services catalog. Does anyone has any idea on how to do this???? Is this possible at all???
    Thanks in advance....

    Can you send me the link in English??
    This is how you can get a single package from IS catalog
    http://social.technet.microsoft.com/wiki/contents/articles/25913.import-a-ssis-project-from-catalog-using-t-sql-script.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

Maybe you are looking for