Stored Procedures – How to recalculate and adjust the entire time series in SQL Server?

In SN = 1 I have an original schedule of 09:15:59 with my first time in being 09:50:57, so I'm about 34 minutes late. In SN = 2 my timeout is 13:27:05. At SN = 4, I arrive again at 15:40:13, giving me a missing time of 133 minutes, as you can see in SN = 3. My problem now is how to adjust or update the entire table row where I can enter, update, or update an official business time between 13:30:00 and 15:00:00, as shown in the following table …

Attendance plan table

This is the output if I enter the OB time from 13:30:00 to 15:00:00

This is the output if I enter the OB time from 13:30:00 to 15:00:00

stored procedures – output result as 2 separate columns

So I've created a procedure that calculates the mean and median of a string array of numbers:

CREATE PROCEDURE dbo.spAvg_Median
@input nvarchar (20)
AS
BEGIN
@ declare split table (id int primary key identity (1,1), number int)

INSERT INTO @split SELECT value FROM string_split (@input, & # 39 ;, & # 39;)

Average SELECT FROM (
SELECT SUM (number) / COUNT (number) as [Average]
        FROM @split
) AS T1
UNION
SELECT MEDIAN (
Select the number AS [Median], rn = ROW_NUMBER () OVER (ORDER BY o.number), c.c
FROM @split AS o
CROSS APPLY (SELECT c = COUNT (*) FROM @split b) AS c
) AS x
WO IN ((c + 1) / 2, (c + 2) / 2)
THE END
BACK 0
GO

However, when you run this query, you get the following result:

EXEC dbo.spAvg_Median & # 39; 1,5,9,8,7 & # 39;

Enter image description here

What I want to spend is average in one column and median in another column next to it.

The UNION command is in place so it will not be output as two different queries like this, because that's not what I want:
Enter image description here

What is an example of exploiting security by enabling the server configuration option of Ole Automation Procedures?

The CIS controls for SQL Server 2008 and 2016 use this text

The Ole Automation Procedures option controls whether OLE automation
Objects can be instantiated within Transact-SQL stacks. These are
Extended stored procedures that allow SQL Server users to run
Functions outside of SQL Server.

Justification: Activating this option will
Increase the attack surface of SQL Server and let the users execute
Functions in the security context of SQL Server.

The risk is that the object you call from your stored procedure does not do what you think. As far as I know, you can not sign Ole Automation objects or guarantee that the actions you take will meet the intended requirements.

To repeat it again, the OLE object is an untrusted source that executes your stored procedure with the permissions granted to it. A mitigant is to give only the minimum permissions to the user calling the procedure and set the usage context to 4 when creating what is described as

A local OLE server does not have access to SQL Server resources.
and it can not corrupt SQL Server storage or resources.

See here for more details.

In addition, SQL Server 2008 R2 will no longer be supported in July 2019. Maybe an upgrade should be considered.

Checking the accuracy of stored procedures – Software Engineering Stack Exchange

Suppose you have 2 stored procedures, say a GetProducts and a GetProductDetails,
Now GetProducts returns a list of products with a property that has been "calculated" based on additional calculations (last purchase, number of resellers, etc.).

How can I be sure that the returned data is correct?

Do I have to invoke the GetProducts, then call the GetProductDetails for each product and finally check the correctness of each result?
Or do I only need to call the GetProductDetails for random products?

amazon web services – Cross-region Aurora MySQL replicas fail with views / procedures / functions

When I set up cross-region replication with Amazon Aurora-mysql (1.x platform, 5.6 engine version), this works fine until I create a view, function or procedure in the master and the slave encounters an error and replication ends until I call CALL mysql.rds_skip_repl_error;, The error is:

[ERROR]    Slave SQL: Error & # 39; access denied; Upon request, you will need at least one of the SUPER privileges for this operation. Default database: & # 39; mydatabasename & # 39 ;. Query: & # 39; CREATE DEFINER = `myusername` @`% `PROCEDURE` MyProcedureName` ... (SNIP SQL HERE) & # 39;
2019-05-09 02:29:10 8118 [Warning] Slave: Access denied; You need at least one of the SUPER privileges for this process. Error_code: 1227
2019-05-09 02:29:10 8118 [Warning] Slave: Access denied; You need at least one of the SUPER privileges for this process. Error_code: 1227
2019-05-09 02:29:10 8118 [ERROR] Error while executing the query, slave SQL thread aborted. Fix the problem and restart the slave SQL thread with "SLAVE START". We stopped at the log & # 39; mysql-bin-changelog.000016 & # 39; Position 24293051

This is because the slave is doing the replication as rdsrepladmin User, but when I create my procedure on Master, I am logged in as my username, I can not set DEFINER to anything else because Aurora does not give me SUPER authority (which you will need to create a view / procedure / function as another user).

I also do not seem to be able to ignore views / procedures / functions as part of the replications.

Is there a way out except to call? CALL mysql.rds_skip_repl_error; on the slave, I have to tap each time a view / proc / function?

Schengen – (Help) Can I change the Schegen visa type between visa procedures?

I am an Indian student studying in a science institute in India. For a 3-month internship in physics in the summer, a professor in Germany enrolled me at the TU Dresden. I applied for a short-term internship Schegen visa and received an e-mail 15 days later that I have to submit ZAV / work permit to get a visa.
But since I am enthusiastic as a student and have also paid summer semester fees, I do not need a work permit. Did I apply for a wrong Subvisa type? If so, how do I change it, documents are still in the German Embassy in Delhi.
I've already missed a late visa and my prof is really mad at me. What should I do ?
Please help !!!!!!

php – Using procedures with cakephp 3.7

However, I have found some articles that show examples of how procedures are used in projects that use cakephp. However, I have difficulty sending a json to my controller by mail (ajax) (as a parameter for my procedure).

my code:

out of my sight:


in my controller

public function index () {
$ connection = ConnectionManager :: get (& # 39; default & # 39;);
if ($ this-> request-> is (& # 39; Ajax & # 39;)) {
$ a = $ this-> request-> date['resTeste'];
$ settingUpdate = $ connection-> execute ("CALL weekly settings ($ a)") -> fetchAll (& # 39; assoc & # 39;);
}
}

I do not know cakephp very well if someone has any tips, thanks in advance! Thank you