Questions tagged as 'sql-server'

1
answer

Insert via EntityFramework "IDENTITY_INSERT is set to OFF" error

I have several models and for some reason one of them has the following error: Cannot insert explicit value for identity column in table 'tbl_boleto' when IDENTITY_INSERT is set to OFF. I remember that I have already entered a record, but...
asked by 03.03.2016 / 13:17
3
answers

Difference between dates in several lines

Is there any way to do a DATEDIFF / LEAD / LAG in SQL Server to calculate the difference between dates taking into account the previous / next record date. SELECT SELECT NUM, CLIENTE, EMISSAO FROM PEDIDOS WHERE CLIENTE = '06.028' ORDE...
asked by 02.03.2016 / 19:20
1
answer

Save value from a select in session

Good morning, I have a select where I bring the categories in my php site, after selecting the category I needed to redeem the value field to use it in the select sub-category. I think the best way would be in the categories onchange. But...
asked by 04.03.2016 / 14:58
1
answer

Execute an insert in the temporary table in SQL SERVER

I have the following code below. declare @ac varchar (max) = '(' + replace ('2398,2399,2405,2407,2523,3509,3510,3518,3523,3524,3601,3859,4713,4728,4735,47362398,2399,2405, 2407,2523,3509,3510,3518,3523,3524,3601,3859,4713,4728,4735,4736 ',',...
asked by 13.05.2016 / 00:57
1
answer

The multi-part identifier "System.Data.DataRowView" can not be associated

try                 { if (cmbFavorecido.SelectedValue != null ) { txtID.Text = cmbFavorecido.SelectedValue.ToString(); cn = conexao.ConectarSqlServer();...
asked by 25.02.2016 / 12:29
1
answer

Procedure to delete and then insert data

Could someone guide me on how to construct a procedure to delete data from a table (already created with SELECT INTO), every day such an hour and then soon fill it again. Thanks in advance for your attention.     
asked by 13.03.2016 / 17:16
1
answer

SQL data counts filtered by multiple tables

I have a page in PHP where I have to generate a chart of "Registered sellers" filtered by region. The problem is that the Sellers table has City Id, the City table has the State Id, and the State Id has the Id. And I need to filter the selle...
asked by 14.04.2016 / 22:34
1
answer

Trigger execute update after the procedure has been executed

I would like to know how I do in SQL Server for a trigger check if the procedure was executed and if it was executed, this trigger will do another update. Thanks in advance for your attention. Att, Marcilio     
asked by 30.03.2016 / 19:46
1
answer

How do I make a basic configuration in the persistence.xml file to access a database in SQL Server 2008?

I looked into how to configure the persistence.xml file in a basic way, but I was even more confused about this configuration. So, I'd like to know how I can do a basic configuration in the persistence.xml file according to JPA...
asked by 01.04.2016 / 21:04
1
answer

How to add a default constraint on a column already created in SQL Server?

In SQL Server, assuming the column already exists, how to create a new DEFAULT constraint? I searched in various references and in all instances, I always had the column to create together. I found the question interesting and would like to inte...
asked by 21.01.2016 / 20:46