Questions tagged as 'sql-server'

2
answers

Add rows with the same ID in additional columns

I have the following table scenario: +-------------------------------------------------------------+ | ID | DATA | PROFISSAO | SEQUENCIA | +-------| --------------|-----------------------|-------------+ | 1 | 2018...
asked by 22.05.2018 / 22:32
1
answer

SQL SERVER - RELATIONSHIP 1: N

I have two tables: books and publishers . Their relationship was defined as follows, a book can have a publisher and a publisher can be in several books, ie 1: N. I learned that the foreign key (FK) should be in table N, in this case, i...
asked by 26.02.2018 / 22:00
2
answers

Relate tables in a single SQL Server query

I need a query that returns to each map the players that had battles in it, the amount of battles that each player had (in the respective map), the total time played (by player in the respective map), and the amount of transgressions (by player...
asked by 07.11.2017 / 20:17
2
answers

INNER JOIN + LEFT JOIN

I'm trying to query the data in 4 tables : TAFCBHISTPED = NUPED, DTEMIS TAFGRPROD = CDGRPR, DSGRPR TAFPROD = CDPROD, CDGRPR TAFITHISTPED = NUPED, CDPROD, QTPED My query looked like this: SELECT TAFCBHISTPED.NUPED, TAFCB...
asked by 25.10.2017 / 19:05
1
answer

Error trying to add time field (varchar) sql server

I have a query that returns the following data: SELECT * FROM METAS mes lj saldo meta 4 2 153:59 123:00:00 4 2 25:33 00:00:00 4 2 29:57 08:00...
asked by 08.05.2018 / 01:04
2
answers

How to extract in a string the date-time of a given XML field - SQL Server 2012 Query

Good afternoon! Personal, in my table log has a field called logdescricao and in this field it stores several expressions. For example: <log expressao="7085"><par traduzir="N">André Mariano da Silva</par><par traduzir="...
asked by 05.09.2017 / 19:38
1
answer

How to represent the real type in C #?

I have an existing table in a database of my client and there has an attribute with data type REAL . How do I represent in C #? float or decimal ? What is the best way?     
asked by 20.08.2017 / 21:00
1
answer

CASE with IN does not work

I want to do this search below: DECLARE @codccu VARCHAR(10); SET @CodCcu = '63' SELECT E.codepi, E.numcad, Max(E.datent) AS ENTREGA, Max(E.datent) + P.diaval AS VALIDADE, CA...
asked by 01.06.2017 / 14:56
1
answer

How to assign an EXECUTE SP_EXECUTESQL @SQLSTRING to a temporary table

Is it possible in the same script to create a temporary table from a run like this? --****************************EMPRESA****************************** if(Object_id('tempdb..#TBEmpresa') is not null) drop table #TBEmpresa go CR...
asked by 14.06.2017 / 17:18
1
answer

How to create a single index based on two columns?

I have a table with these columns: ip nome email I want ip and email to be a single pair. The same value of ip can contain multiple records and a same email can also contain. But the same ip and even em...
asked by 17.10.2017 / 21:48