Questions tagged as 'sql'

2
answers

Passing value of a VARCHAR variable in the WHERE IN command

Good evening. I have the following example procedure CREATE PROCEDURE sp_listaFuncionarios @nome_dept varchar(50) as SELECT * FROM Funcionarios WHERE nome_departamento IN (@nome_dept) If, during the procedure call, you want to pass two c...
asked by 14.01.2016 / 01:30
2
answers

Recover database records by date field?

How do I retrieve users saved in a database table by field dt_nascimento through two values that represent the minimum and maximum age of users that should be returned, the minimum and maximum age does not always come together can be specified o...
asked by 28.04.2015 / 16:55
3
answers

Show table comments

Good morning guys, I would like to know if it is possible to list all the comments in my "table" in SQL-SERVER, not column comments, but only the "tables"     
asked by 07.08.2018 / 14:41
2
answers

SQL Server - CONCAT + IF in VIEW

I have a problem and I will try to explain the situation. I have a client table called ENTIDADES , in it there is an attribute called ID_GRUPOECONOMICO where this is a FK of the GRUPOECONOMICO table. I am creating a...
asked by 07.08.2018 / 22:57
4
answers

How to write a store procedure that uses values from the current and previous row?

I have the following table, # id # dataTmp # referencia #nProduz#nStock # id2 #necessi# # 115237 # 31-01-2017 # VL03280103 # 0 # 0 # 6 # 0 # # 115238 # 01-02-2017 # VL03280103 #...
asked by 30.01.2017 / 15:26
2
answers

Application does not save data and only saves code

I'm developing software for an MVC (model-view-controller) design video store and the problem of not saving people is occurring. It only saves the code of the people and I do not even know why it is happening not to save the clients because my s...
asked by 22.10.2015 / 19:01
2
answers

Receive variable value in 'where in'

In my procedure I have the following variables: @Codigo VARCHAR(MAX),@cont as int, @DataPago as VARCHAR(10) Via C # application I'm passing the values as follows: y1.Parameters.Add("@Codigo", SqlDbType.VarChar).Value = "2,4"; y1.Pa...
asked by 23.10.2015 / 18:10
1
answer

Error in SQL QUERY

SELECT COUNT(*) AS total FROM table GROUP BY (YEAR_MONTH FROM data) ORDER BY (YEAR_MONTH FROM data) ASC You are giving _YEAR_MONTH_ error and I do not know why     
asked by 27.06.2018 / 10:49
1
answer

Temporary table with underscore

I'm trying on my service to create temporary tables as I've always learned by putting # in front of the name I want. But I do not know what happens when I create one, it puts a huge underscore and some random stuff after the name. For exa...
asked by 27.06.2018 / 03:07
3
answers

SQL Query, Always show first record of a repeating field

I'm having trouble listing only one line in each process. The query must always bring the protocols with the last revision. Ex: Show only the process of number 2 of the last revision 2 and Show only the process of number 1 of the last revisi...
asked by 20.06.2018 / 15:35