Questions tagged as 'sql-server'

1
answer

SUM and GROUP BY duplicating values

When trying to aggregate and group values, I noticed that SUM and GROUP BY are not behaving the way I expect and I could not identify the cause. Performing the query below SELECT representantes.cod_representante, represent...
asked by 18.08.2016 / 15:55
2
answers

How to join 2 tables without repeating data?

I have 2 tables, one call SR7010 and another call SR3010 . The primary key of the two is the field R7_MAT and R3_MAT. The query I'm trying to perform is this: SELECT R7_FILIAL, R7_MAT, R7_DESCFUN, R7_DATA, R3_VALOR FROM SR701...
asked by 19.08.2016 / 21:15
3
answers

Error "... is not a recognized built-in function name" in SQL Server

I'm not getting an insert into the SQL Server database. Here is my code: INSERT INTO TB_Cadastro (Cod_Vac, CodIN,Produtor, Codmal, DataVac, DataCompra, NumDoc, SerieDoc, UFDoc, CodMunDoc, Lab, NumPartida, Validade, Revendedor, Doses, Qtde, Obs...
asked by 10.08.2016 / 23:03
3
answers

Use of select with function SUM ()

I'm developing a database for a small application. My bank has 3 tables: students, disciplines and school_letter, the latter used to insert 3 individual notes. I have been able to calculate the average of these NOTES through the SUM () fun...
asked by 27.07.2016 / 16:12
1
answer

Error executing query sql server + php + pdo

Follow the code: $conexao = new PDO("odbc:Driver={SQL Server};Server=127.0.0.1;Database=MASTERDB; Uid=admin;Pwd=admin123;"); $select = $conexao->query("IF Object_ID('tempDB..#TabBatidas', 'U') is not null DROP TABLE #TabBatidas; SET D...
asked by 01.11.2016 / 22:26
1
answer

Microsoft SQL Server for MySQL

I need some help. I downloaded a project in C # from inventory control, however the database is by Microsoft SQL Server, and I would use MySQL to connect and record data. Here is an example of connection files: Archive: DAL > using...
asked by 15.06.2016 / 00:44
1
answer

Problem with IN clause

I need to use the IN clause in a situation where the in part is a string. Example: SELECT * FROM BLABLABLA WHERE 4 IN ('6,5,4') This causes me this error: Conversion failed when converting the varchar value '6,5,4' to data type int....
asked by 23.05.2016 / 16:04
2
answers

How to do a select in date format?

How do I perform a select using dates in SQL server 2008 ? When I do a search with this select: select * from NOME_TABELA where DATA_FISCAL between '2016-05-01' and '2016-05-11' The result is 12 records including one record has the da...
asked by 13.05.2016 / 17:04
2
answers

How to make change in database without having a clear primary key? [closed]

I need a method to do data change in a SQL Server table. According to my client, all the table data can be changed. By having this possibility, I am without a fixed and unique reference for the bank to know which data will be changed. UPD...
asked by 23.03.2016 / 15:38
1
answer

Why to perform UPDATE with JOIN does not conform to conditional WHERE

I will substitute values of a column in table A for values of table B, being conditioned by a column of table C. When you perform UPDATE, the conditional is not being respected and all values are being changed. UPDATE tabela_precos_prod...
asked by 28.01.2016 / 17:30