Questions tagged as 'sql-server'

1
answer

Update to remove a piece of a varchar field

I have a column with a varchar field. In this column it has a value like this: http://dominio/img//12.jpg I want to make an update that leaves this field like this: http://dominio/img/12.jpg This // I want to remove always starts at a...
asked by 19.05.2015 / 15:00
2
answers

How to use Sum with subquery

How can I use sum with a subquery inside? I tried in many ways, but I could not. When I try to put sum right after the main select , I get the message that I can not use aggregate function with aggregate or query. SELECT SUM(CONVE...
asked by 20.02.2017 / 12:38
1
answer

Sql server transform a column into several rows

Good morning I have a table called books that has 3 fields, Code, Name and Chapters Example content: 32 - Jonas - 4 I need that after the select return the following result to me Codigo e Capitulo 32 1 32 2 32 3 3...
asked by 02.02.2017 / 10:51
2
answers

How to do paging in SQLServer 2008 R2? [duplicate]

I tested it in two ways, but I did not succeed. select * from table OFFSET 10 ROWS select top 10 * from table OFFSET 10 ROWS FETCH NEXT 5 ROWS ONLY Strangely enough I've never needed to use offset in this version of SQLServer, and now I'...
asked by 22.08.2017 / 21:09
1
answer

Date is not "white" sql-srv

I have a column in the database type date . WhenIchangesomedateinaformphpandleaveitblankthesameinsteadofbeingblankitbringsmebacktodatewith1900-01-01.BelowistheinputIusetochangethedate.DateOutput:<inputtype="date" id="saida" name="sa...
asked by 05.04.2016 / 14:49
1
answer

Problem with SQL Server connection

I have a PHP system hosted on a Linux server that queries a SQL Server database through mssql . Works perfectly on the server. I needed to make some changes to this system, so I put it in my localhost and it was working ok. Out of all, que...
asked by 17.03.2016 / 12:31
1
answer

How to identify the Entity that throws the error when saving?

In my application, with Entity Framework, I make a query in an Entity Framework: var lista = contexto.Rodada.Where(condições); Then iterate over this list with a foreach. During the iteration there are "updates" and "inserts" of several...
asked by 17.03.2017 / 22:21
1
answer

SQL Server rotary records

I would like to know how to select routing records from a table. For example I have a table called disclosure and I want the records to be selected in such a way that today swallows the element x, y, z. Tomorrow, swallow y, z, x. The next day z,...
asked by 15.12.2015 / 21:16
1
answer

Get the max value inside a while that is inside a cursor

My question is this: I have my cursor for the interaction line by line and inside it I have a while for horizontal interaction. I'm trying to populate a table whose PK does not have identity , using MAX and setting +1 in w...
asked by 25.08.2015 / 20:21
1
answer

Performance on queries with string filter vs foreign key

I'm working on a Asp.Net MVC 5 project that uses code first and all entities have a property named UserId of type string . When I make queries filtering by a certain user ( Asp.Net Identity ) I do so: string cu...
asked by 20.08.2015 / 19:18