Questions tagged as 'sql-server'

2
answers

Concatenate fields in a more performative way

I am concatenating the description lines of a record so that instead of having N records for a description it has only one. I can make it happen, but I wanted a more performative way, because I'll do it with a table with some 900,000 records....
asked by 12.03.2016 / 01:03
1
answer

What is the difference between TRUNCATE and DELETE + CHECKIDENT?

Both perform the same action (delete + zero the PK value), but in performance what is the difference between them? Example: When you have more records it is recommended to use what form? TRUNCATE : TRUNCATE TABLE Exemplo DELETE +...
asked by 24.07.2014 / 17:28
2
answers

SQL Server 2005 and row versioning

In my current scenario, every Friday, I need to list all rows in a table that have been added or changed. In this table we have a DataDeInclusao field that obviously receives the date of inclusion of that record. My problem is to li...
asked by 16.04.2014 / 16:04
1
answer

How to return the last value of an sql string?

I need to use the last character of a string G. How do I get it with sql server? SET @VALOR = '0000050529-G' I want to get the letter G     
asked by 13.12.2018 / 14:04
2
answers

How is the generated query created in Linq when we do UPDATE?

How is the generated query created in Linq when we do UPDATE? using ColWebDBContext.DBase.Banco; using System; using System.Web.UI; using System.Linq; namespace DBContext { public partial class _Default : Page { protected void...
asked by 28.10.2016 / 20:24
1
answer

SQL increasing the ID by 1000 units

I have a database in SQL Express with a reasonable amount of data for more than a year. It has always worked fine, but now it is presenting the following problem: sometimes the ID in some tables ends up increasing by 1000 units. I did a littl...
asked by 14.10.2014 / 19:45
1
answer

How to make a query that returns data of the last 7 days without considering Sunday

I need some condition in SQL SERVER to return the result of the list of elements taking into account the last 7 days of creation of the same. However he can not consider Sunday as a valid day in the query. Inquiry: Select SearchId, g...
asked by 24.03.2015 / 19:25
1
answer

How to restrict dates in MySQL and SQL Server?

I wonder if I can restrict certain dates in the database itself, not the code. For example, I have a table that records date of entry and date of exit. Here are some requirements. The date of entry can never be greater than the date of ex...
asked by 05.08.2016 / 14:55
1
answer

Difference between table temporary and table variable

In SQLServer there are table and variable table and variable table features. What would be the most advantageous or best option to put in a procedure that inserts the query that was returned from a SELECT , and can store an average of 2 t...
asked by 24.05.2017 / 13:47
2
answers

Convert and save photo in BD

I'm working on a project where I have to save some photos. So I'm looking at the best way to accomplish the task. I thought of saving to the database, because these photos will be accessed both locally (WinForms application) and via internet...
asked by 08.05.2017 / 00:38