Execute Queries in sequence [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have 5 queries
all are dependent on one by one
i have to run all queries in one time but it will be executed in sequence
it's possible..?
please help me

You can build a stored procedure and execute each query in desired order by placing the queries in corresponding execution order

you can use SSIS's sequence or process container to execute all of your SQL encapsulated in stored procedure at the same time, the provided screenshot show's processes in precedence, but you can also design them to execute at the same time.
Hope this helps.
Cheers!
Imagination is more important than knowledge

Related

Using SQL Transactions for a single sql query [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I have read a lot about SQL-transaction the pased few days.
But i have not found an answer to my question. So maybe someone here can solve my problem?
The exact question is: Should i use a sql transaction for a single select/update/insert statement?
Or is it to overact to use SQL transactions for a single sql statement?
Thanks...
regards
Ali
Individual statements implicitly have their own transactions. By default, individual statements create and rollback/commit themselves. In theory, you can make it so that it will behave like an explicit transaction, although I can't think of a super great reason to do this. https://learn.microsoft.com/en-us/sql/t-sql/statements/set-implicit-transactions-transact-sql?view=sql-server-2017
The only reason I can think of to wrap an individual statement in its own explicit transaction is if you wanted to leave the transaction open so you could test something like blocking, or just maybe check the data while debugging before rolling it back.

Comparing Two SP's Performance SQL Server [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
there is any simple way to know which one of two SQL Store procedure works better?
Click the Include Actual Execution Plan before running both sp (on the same run) and check the percentages

SQL Server : create jobs [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to create a procedure which repeats itself several times. Let's say I want to change a character's position in a browser game for 3 minutes from one place to another. Its coordinates change constantly in the database. I need it to be dynamic so that I can use this code to move the character to more places in a different amount of time depending on the parameters passed to the procedure.
How can I do it?
Does jobs solve the problem? If so, how can I do it with jobs?
You could use the RAND() function to generate random coordinates, and a sql agent job to run the procedure throughout the day.
Since you mentioned that the coordinates change constantly in the database, you can have an update trigger that runs the stored procedure you have in mind instead of relying on a job. Let me know if you need more info on this.

Store a temporary table and update it every hour [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have never done this before, and I'm not sure if it is possible. Basically, I have a big query that takes around 1-2 minutes to run. What I'd like to do is:
automatically execute and put result into a table every hour.
My webpage will then query against the temporary table instead, which should be quicker.
I am looking for the steps to do this like. First, create a stored procedure. Second, setup somewhere to run the store procedure automatically. I'm not sure how to proceed — can you suggest how?
SQL server supports running scheduled jobs. You can look here.
http://technet.microsoft.com/en-us/library/ms190268%28v=sql.100%29.aspx
Also check this question, it should give you
a very good idea of the steps you need to take.
How to run a stored procedure in sql server every hour?

Execute sql-statement once at date x [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to have an sql update-statement executed once at date x. How can I achieve this on an Oracle 10g database?
EDIT:
My aim is to fire an update statement every day. Why? I have a tiny mistake in my application, that can be 'temporarily fixed' with this statement (since I only have db-access till the real fix will happen).
Jonny
Consider DBMS_SCHEDULER. It is meant for running jobs periodically, but you can set up your pl/sql job script to suspend or cancel the job entry after your run-once job ends successfully.
http://docs.oracle.com/cd/B28359_01/server.111/b28310/scheduse.htm
You can use Crontab to schedule a task to be executed at given day/time.
See: http://en.wikipedia.org/wiki/Crontab