I find it useful to define a variable with the path, if I want to execute a set of scripts, say to run a test, something like::setvar path "C:\code\branch-qa":r $(path)\tables\client.sql:r $(path)\tables\item.sql:r $(path)\proc\clientreport.sqlexec clientreport
You can use osql or better yet the newer sqlcmd almost interchangeably. I am using osql in this example only because I happened to have a code sample sitting around but in production I am using sqlcmd. Here is a snipped of code out of a larger procedure I use to run update scripts against databases. They are ordered by major, minor, release, build as I name my scripts using that convention to track releases. You are obviously missing all of my error handing, the parts where I pull available scripts from the database, setup variables, etc but you may still find this snippet useful.
The simplest way would be to make your scripts stored procedures, and to call (via the EXECUTE command) each procedure in turn from a central procedure. This is ideal if you're going to run the exact same script(s) over and over again (or the same script with different parameters passed in).
If your scripts are .sql (or any kind of text) file, as @Abe Miesller says (upvoted) you can run them from within SSMS via the :r command, when SQLCMD mode is enabled. You would have to know and script the exact file path and name. This cannot be done from within a stored procedure.
Assuming you want to keep the 10 scripts in their own individual files, I would say the easiest way to do what you want would be to create a batch file that executes osql.exe to execute the 10 scripts in the order you want.
In SQL Server 2008 R2 you can go on the DB, right click on DB -> Tasks -> Generate scripts. This is the wizard for scripting the objects (with or without data). Follow the stepts described on the first page. At the third stept, "Set Scripting Options", after you choose your way to save /publish your data, you go on "Advanced" and there, for General Options, at line "Types of data to script" you can choose to script also your data ("Schema and data").
I have ArcGIS Pro 2.9.5 installed on my desktop. I have ArcGIS Enterprise 10.9.1 installed on our server. I have administrative access. Please help me find a way, in Python, to list all services that use the ArcMap runtime, in preparation for our upgrade to Enterprise 11. Here is what I have so far:
However, ArcGIS Server 10.9.1 offers a button in ArcGIS Server Manager that allows a person to convert their ArcMap run-time service into an ArcPro run-time service. Meanwhile, the source of the service remains the same: an .mxd document. When you look at ArcGIS Server Manager, it says right there under the service description which run-time it's using; I just don't know why it's been so hard for me to find that piece of data using the API.
I appreciate your reply. I'm aware that Server makes a copy of the original ArcMap document, and that sometimes there are changes to it, like when data is copied to the server. What I was trying to explain is that you can have an ArcGIS Server service running with the Pro run-time, even though it was originally published with ArcMap. I explained in the last reply how a user might do that. Once the conversion is done, the original ArcMap document remains in the folder, and Server Manager will continue to report that the original document was an .mxd, even though a service is running with the Pro run-time.
I actually have done a fair amount of research in the past, and I'll explain an alternate method that runs from the run script activity. The short answer is, it isn't as easy, so prepare yourself! As you may know, all the external reaching scripts all go through the ECC Queue, I recommend reading up on it. This trick basically creates a Probe ie making an ECC Queue input/output record, and it executes the powershell.
You'll need a defined Discovery Probe to make this work though (Discovery Definitions -> Probes -> New). Then you'll need to set the ECC queue topic to Command, and ECC queue name to be powershell C:\MyScriptHere.ps1 for example. Command executes the probe name with cmd in windows. I have mine pointed to my dev mid server's agent script folder, this is the default folder for the MID Server scripts.
After that, you need to kick off that cool probe you just made via a Run Script or Scheduled Job or BR. You can do this by using a rather undocumented SN API called SncProbe. I picked up the syntax from an OOB script include (you can also do this manually using a GlideRecord insert, but I digress). You set the source to be the local MID server, and your name, etc to match the above Probe. Note that you have to comment out the \ signs here since it's Javascript.
google.script.run is an asynchronous client-side JavaScript API available in HTML-service pages that can call server-side Apps Script functions. To interact with dialogs or sidebars in Google Docs, Sheets, or Forms from client-side code, use google.script.host. For more information, see the guide to communicating with server functions in HTML service.
Sets a callback function to run if the server-side function throws an exception. The Error object is passed to the function as the first argument, and the user object (if any) is passed as a second argument. Without a failure handler, failures are logged to the JavaScript console. To override this, call withFailureHandler(null) or supply a failure handler that does nothing.
Sets a callback function to run if the server-side function returns successfully. The server's return value is passed to the function as the first argument, and the user object (if any) is passed as a second argument.
This tutorial teaches you to generate Transact-SQL (T-SQL) scripts for various objects found within SQL Server Management Studio (SSMS). In this tutorial, you find examples of how to script the following objects:
The following section teaches you to script out the database by using the Script As and Generate Scripts options. The Script As option re-creates the database and its configuration options. You can script both the schema and the data by using the Generate Scripts option. In this section, you create two new databases. You use the Script As option to create AdventureWorks2022a. You use the Generate Scripts option to create AdventureWorks2022b.
You can script the data for the database when you select Schema and data for the Types of data to script option. However, this isn't ideal with large databases. It can take more memory than SSMS can allocate. This limitation is okay for small databases. If you want to move data for a larger database, use the Import and Export Wizard.
This section covers how to script out tables from your database. Use this option to either create the table or drop and create the table. You can also use this option to script the T-SQL associated with modifying the table. An example is to insert into it or update to it. In this section, you drop a table and then re-create it.
The callback script is scheduled to run on the client after any current script has been completed, just like scripts that are triggered by the Install OnTimer Script script step and the OnWindowTransaction script trigger. The context in which the script runs is unknown and cannot be depended on to be the same as when this script step was executed. If needed, use the callback script's parameter to pass back enough context for it to run as expected on the client, such as the layout and found set to use.
Runs a script on the server and sends the current layout name, customer ID, and customer email address as the script parameter. The server navigates to the layout and record specified in the parameter, saves a snapshot link of the current record, emails the snapshot link to the email address specified in the parameter, and returns a result. The client fetches the script result from the server and displays it in a custom dialog box.
So for some more info on this, below is a shot of my classpath, from within the IDE my DSS connections and all actions through the scripting engine are successful. I cannot even get a connection when running an executable JAR.
In my main function I set up my JavaFX stage, instantiate an eol_server object then call getdssserver and launch the GUI. In the GUI we choose when to connect via a Java FX menu command, this permits selecting software builds and target configuration files before connecting. The connection method is as follows:
The above would indicate that it has nothing to do with the target debugger or CPU but rather the pre-configured target ccxml file that was set up for the server. I assume that the executable Jar is not able to resolve the file. How have other people passed the string in an executable DSS Application?
When I do this, the application does load but then shutsdown immediately with an exception trace that indicates I cannot create my server instance as I cannot find the ScriptingEnvironment class. Here is a screenshot of my command line execution and the classpath showing all the dss jars. I don't know why this does not work, any ideas?
It still seems strange to me that the connection could not be made through the target configuration file when running in an executable Jar, all other actions to instantiate the server environment etc seem to be OK. You can see in the screenshot below the successful connection trace output
There is also WinSCP .NET assembly built on top of the scripting interface. If you plan to call WinSCP from your .NET code or PowerShell, or if your task requires conditional processing, loops or other control structures, you should better use the .NET assembly. This guide focuses on simple automation tasks using scripting interface only.
Use the /script command line option to pass the script to the WinSCP executable. Generally, you should also use /ini=nul switch to isolate the script execution from GUI configuration and /log= switch to enable session logging. You can embed the complete command line into a Windows batch file (.bat), like as follows:
aa06259810