Questions tagged as 'sql-server'

2
answers

Alternative for Exists ()

I'm looking for an alternative to using the command Exists in procedures that I need to perform a large query and check if it returns some data, if it does not return to look for it should return a select with all its columns with the val...
asked by 08.04.2015 / 22:13
2
answers

I can not configure the sqlsrv drivers in php7 [duplicate]

In the file php.ini all extensions are found, less the ones I need to connect to the SQL Server database. extension=php_sqlsrv_7_ts_x64.dll extension=php_pdo_sqlsrv_7_ts_x64.dll The .dll is in the C:\php7\ext. No...
asked by 04.01.2017 / 19:26
3
answers

Select 1 record of each ID based on the last date

I have a dummy TB_META table with the fields: COD_VENDEDOR | DAT_ATIVACAO | VAL_META Assuming I have these values in the table: 1 | 2011-01-01 | 1 1 | 2014-04-04 | 2 2 | 2012-01-01 | 3 2 | 2013-03-03 | 4 3 | 2013-01-01 | 5 3 | 2014-04-04...
asked by 23.07.2014 / 05:01
1
answer

Query Entity Framework relationship Many to Many

I'm starting to use the Entity Framework and am wanting to query between two tables, Livroes and Autors , and their relationship is of type Many to Many . I do not know if it's relevant but I'm using the Code First method, so I...
asked by 21.02.2018 / 14:16
1
answer

Making the insert in SQL Server in a float field?

I have the following problem in my code, I have a textbox that receives the value 0.900 , but when I am writing this value to the bank, it is only recording 900, and I need to record the 0.900 and I can not write this way, the field...
asked by 08.08.2017 / 15:00
2
answers

Concatenate table name loop sql server

I'm trying to populate a table of my with a loop in sql server follow the code: declare @i int set @i =1 while @i < 5 begin INSERT INTO TABELA VALUES('teste') set @i = @i + 1 end I would like to concatenate the name of the table in the...
asked by 04.07.2014 / 16:40
2
answers

I need a new random number for each line in a sql query (server)

I use the sql server . I need to use a random number in several different columns (the same random number) but I want a new random number on each line ... For example, let's assume that TABELAX has only 5 rows and I'll query the genre ......
asked by 16.11.2016 / 11:43
2
answers

Divide string into substrings and search for them in another

I am creating a function in which I will check if a endereço_A contains parts in a endereço_B , exemplifying: address_A AVENIDA JOÃO E MARIA B_address RUA JOÃO The result should return JOÃO , w...
asked by 01.12.2016 / 15:11
2
answers

Syntax difference between database

What is the difference, in the syntax, of the following databases, for a simple query, of type: SELECT * FROM tabela WHERE id = '1' ORDER BY nome GROUP BY nome LIMIT 1 Or, what do they differ in syntax in general? Or is it all the same?...
asked by 05.11.2017 / 04:07
2
answers

PDO :: rowCount () returning -1

I have this routine below, which I used without problems with a MySQL database. However, I had to migrate to a SQL Server 2008 database, which was simple. The only problem is that, I do not know why my rowCount() is returning -1...
asked by 08.12.2014 / 18:15