Questions tagged as 'sql-server'

1
answer

How can I show all deductions for a single employee?

This is my current view that shows me the deductions of the employees what I need is to show all the deductions of an employee If you can see here, it shows all of them, what I want is for you to show me all of the 2390 employee,...
asked by 16.10.2018 / 18:27
2
answers

Several database operations that behave as one

I am doing a system in which, on occasion, I must perform 3 or more movements in the database: read a field, insert in another table, and update some tables; the situation here is that, sometimes, the insertion or update is not done due to some...
asked by 03.03.2017 / 20:14
2
answers

Insert SELECT in a table

I'm trying to insert all the fields with a specific id into a table, I get this data from a select, I want to put them in a table to make queries with the data in this table as a reference. This is what I have declare @json varchar(max)...
asked by 11.09.2018 / 20:36
1
answer

Must declare the scalar variable SQL

Hi, I'm getting this error and I do not understand why? according to me I am already declaring previously @PTI_R This is my current code declare @Iva decimal(5,2) = (.16), @tasaInteres decimal(10,2) , @fechaDispIni date, @sueldoMens...
asked by 25.09.2018 / 17:52
1
answer

Add results of a SUM in SQL Server

I need to add a series of elements that are in fact the result of a sum, I will try to explain myself as best as possible. I have the following query: select distinct cp.descripcion, cp.idSysCPPuestos, em.nombreLargo ,sum(CAST(em.sueldoDi...
asked by 23.10.2018 / 23:28
1
answer

How can I map a VISTA or a STORED PROCEDURE from an sql server database with Hibernate in java se?

How can I map a VISTA or STORED PROCEDURE from a sql server database with Hibernate in Java SE?     
asked by 18.08.2018 / 23:57
3
answers

get the last insert entered sql

I have a database sql server 2012, where I have a table that contains a datetime field, and what I need is to get the last insert that was made, I have the following table and I hope you can help me --------------------------------------------...
asked by 09.12.2016 / 23:00
2
answers

Group or Count SQL Server repeated values

This query brings me the information correctly with the difference that it brings me the duplicates, so what I want to do is another column where you tell me how many times the same number is repeated in this case the repeated ones are here (E.N...
asked by 29.08.2018 / 21:34
2
answers

generate a numerical sequence in an insert into from

hello I have a table that has no identity on its pk (since it is generated through a program that fills the table). I must enter records from another table, but I need a function to generate this id. I have the following insert to add the data....
asked by 30.08.2018 / 20:13
2
answers

SQL statement to locate if a date is between 2 others

I want to be able to find all the records with value 1 in attendance that are between 2 dates for a user: SELECT * FROM asistencia WHERE id='124' AND asistencia = '1' AND fecha BETWEEN '2018-07-30' AND '2018-08-12' And as an additional fi...
asked by 15.08.2018 / 16:41