Questions tagged as 'sql-server'

2
answers

Calculate column date - 6 months from the current date (SQL SERVER)

I have a column in db that is D_EMISSAO and has a date yyyyddmm in it. I have to show the data that is related to column D_EMISSAO if it does not exceed 6 months according to the date D_EMISSAO with the current dat...
asked by 15.03.2018 / 14:00
2
answers

How to do a SELECT while keeping the first column until all records

I would like to do a SELECT that would repeat the first column, but when all the records were over, I would change the data in the first column and repeat all the records again. I'll give you an example to illustrate better, as it's complicat...
asked by 28.02.2018 / 12:50
2
answers

Give an insert in a table with information from two tables

I would like to know how to insert two ids into two tables. For example, there are 5 tables one is a student, which has the following information: +--------+------------+ | ID_ALU | nome | +--------+------------+ | 1 | aluno 1 |...
asked by 03.05.2018 / 15:11
1
answer

SQL SERVER - return different columns of an inner join on the same row

I have the following scenario: Users table Table users access In the usuariosacessos table, each row has the id of the user, the name of the feature, and a field stating whether or not you have access. In my specifi...
asked by 14.03.2018 / 00:29
2
answers

Select columns dynamically with Linq

I have an action in an API that should return a template, however the fields that must be returned are entered in the request. I can query with the System.Linq.Dynamic.Core package, but the performance is pretty bad. What other alternative can I...
asked by 09.10.2018 / 18:50
2
answers

How to change EF6 to create DateTime fields like datetime2

I'm working with EF6 Code-first, SQL-Server database. I encountered the following error when saving an object with DateTime property.    The conversion of a datetime2 data type to a datetime result in an out-of-range value.   ↵The statemen...
asked by 06.04.2018 / 15:37
1
answer

ConnectionString returning null

When trying to execute my project I got the error:    System.NullReferenceException: 'Object reference not set to   an instance of an object. ' I have a bank class with the constructor: public bd() { conexao = new SqlConnection(Confi...
asked by 23.01.2018 / 19:25
2
answers

Select only tuples from a table with JOIN

I have the following query: SELECT finpag.cod_forn ,sicforn.nome ,finpag.data_pagto ,finempe.cod_reduzido ,finpag.num_empenho ,finpag.ano_empenho ,num_liquid ,ano_liquid ,valor_transacao...
asked by 05.02.2018 / 19:26
1
answer

How to fill a Dropdown List with ASP MVC

Good afternoon, how can I populate a dropdown with data from a database using pure Ado.net (code) and without using Entity framework? I have two tables in my database that relate. First I must register a department and when registering a user...
asked by 07.02.2018 / 16:29
1
answer

Error in SQL Server connection with Java in Resteasy API

I'm using the Microsoft 6.0 JDBC driver in a one-time project API using Java (JRE 1.8) with resteasy using Eclipse Oxygen and Tomcat 7 (I tried with other versions and presented the same behavior). My connection code is as follows: public cl...
asked by 11.12.2017 / 14:57