Running Sql Scripts On The Start Of The Application - sql

Hi Guys i wanna know how to run few sql script on our application startup
i am using windows Forms to create a desktop application and have to use this approach for certain task.
database server used is MS SQL

we have to make a method which call the DB script then script will run and do his work. if your next process is depend on that particular script then you have to first call the script and do your work if your next action is not depend on that script so you can keep those script in thread and you can do your work so it will not take a time to load your start point

Related

APEX 5.1: Automatic Copy of an app in Oracle APEX

Right now I have an "Production App" that changes everyday. Every Friday I go to Tasks > Copy this application
Tasks
And send that copy to another ID App, in order to have (for example) "Production App 2" as a backup (I have the DB backup in another server)
Is there any way to make that "backup" automatically?
Thanks in advance
How about exporting your applications regularly (e.g. on a daily basis)? You'd use APEXExport.
As it is invoked from the operating system command prompt, you can create a batch script (.bat on MS Windows) and schedule it (using Task Scheduler on MS Windows) to run at any time you want, e.g. 02:00 (2 hours past midnight)).
That's what I do, works just fine.
Starting APEX 20.1, there is a feature that takes regular backups automatically. There is also this recent blog that shows how to use ORDS to export/import apps.
SQLcl is also a possibility through command line: see here

Script to Automatically Run SQL File

I want a schedule job to run a function/Sql File in SQL Developer without using scheduler in orcale since I only have limited access to the database. Since my function always deletes when database refresh I need to run my function again. I want it to not manually run my sql file. Is this possible using unix script or is there any program I could use for fhis.
P.S It's okay if I need to trigger its using button or something as long as I don't need to run it every refresh of the database. Thanks

Run SQL Process at specific time

I'm trying to build a background process that will check and execute a stored procedure (SQL Server 2008R2) that users will schedule on a UI application. I don't want to create a job, I want to handle it myself. So I was planning to run a check every 2 secs for example and check if there is process that rich the specific time and run it.
Is there any better way to do it?
If you don't want to set up a task within SQL Server, you could write an app that makes the DB call, then schedule that app through Windows Task Scheduler.

Updating System variables in SSIS package

Similar to this post
I have an SSIS Package with a Script Task that creates an Excel file on disk and populates it with data from a SQL Stored Procedure (using Microsoft.Office.Interop.Excel). This works great when testing and when running the deployed package manually through the SSIS Catalog, but when I schedule the task to run automatically through SQL Server Agent, the Package fails in the Script Task step. I have the Job running as a Proxy account that is the same as the account I'm logged into the server with when testing (and the same as the account that works when manually running the packages).
My understanding is that even though the job is running using a Proxy, any desktop interaction occurs within the Profile context of the SQL Server Agent login. Since that profile isn't actively logged in, the interaction fails. Digging in more, there is a bool System Variable in the package called "InteractiveMode" that is set to "False". I have a feeling that if I could switch that to True, everything would be hunky dorey. Trouble is, that variable is only accessible to my Script Task as "ReadOnly"...
Is there any way to set the System:InteractiveMode Variable in an SSIS package manually or programatically at runtime? Please help! I'm having to run these scheduled jobs manually for now, which is a big pain.
Thanks.
I had this problem a few months ago and it turned out that the execution options needed to be set to use 32 bit runtime. If you're using SQL Server 2008 R2, you can open your job and double click on the step. It's under the Execution Options tab.
If you continue to have errors, you may want to consider changing the package so that it uses a file system task to create/rename the excel document and then a Data Flow Task to move the data from your stored procedure to your excel document. Depending on your data, you may need to add a Data Conversion step in between. Here's a good article on the topic: http://www.mssqltips.com/sqlservertip/3046/sql-server-integration-services-data-type-conversion-testing/
Edit:
I haven't used SQL Server 2012 yet, but according to MSDN, it looks like the option is under the Configuration tab. Here's their article: http://msdn.microsoft.com/en-us/library/gg471507(v=sql.110).aspx

Run application in response to database event

I have a an application that needs to run at the end of a series of database jobs in SQL Server 2005. The application will do processing on the data that was created by these jobs.
What would be the best way to trigger the execution of this application?
Depending on the type of application, if it's non-interactive then you can write CLR stored procedure that can be executed like any other stored procedure call.
If you don't mind having the application run on the database server, just add a new job step and execute it as part of the job. The command type is "operating system command (CmdExec).