Questions tagged as 'sql-server'

2
answers

SQL SERVER - Calculation

I have a question for setting up a scorecard and that I can not get out of it. I basically have two tables.    Table 1: CONTRACTS   Fields: Company ID, Contract ID, Product ID, Quantity       Table 2: RECEIPTS   Fields: Company ID, Rece...
asked by 24.08.2017 / 20:25
2
answers

Catch only last query sql server query

I have the following query: SELECT CODIGO, DTINICIO AS INICIO, DTFINAL AS FINAL FROM PFHSTAFT WHERE EMPRESA =1 GROUP BY CODIGO, DTFINAL, DTINICIO It returns as follows:...
asked by 08.07.2017 / 00:03
1
answer

Use CASE in a WHERE clause

I need to use a condition within a filter parameter in a report. Basically the rule is determined by a vachar field that the value of it is 'T' or 'P'. I tried a solution like below but it did not work very well. The rule is, if the field is...
asked by 11.04.2018 / 20:19
2
answers

SQL server data default

Hello, I'm creating a table and I need to leave the expiration date as default on the date 1990/01/01. Could someone help me? Below the code I've created. create table Coordenador ( ID int NOT NULL identity(1,1) ,idlogin varchar(30)...
asked by 04.04.2018 / 13:50
2
answers

Save / Recover files with PDF extension

To save files with PDF extension in the database do you need to do the conversion to base 64 ? Or would you have some other way to save this type and your recovery for viewing? The code I have below, does the image conversion to base 64 ,...
asked by 10.04.2018 / 20:14
2
answers

Returning only one select at a time multiusers [closed]

I have multiple clients connected to a database. These clients make queries, almost at the same time, causing me a headache, when 2 clients get the same result as a select. How do I know when a table is busy or even lock this table until o...
asked by 01.11.2016 / 19:09
4
answers

Return value in SQL Server query

I need this query to return 2 instead of A. TYPEUSUARY is of type varchar. Can someone tell me where the error is? USE DATABASE SELECT TIPOUSUARIO FROM TABLE UP (NOLOCK) WHERE TIPOUSUARIO = case TIPOU...
asked by 21.10.2016 / 14:21
2
answers

Get daily data from the months in the query range

I have a query in SQL Server which returns me the data of 1 ago SELECT titulo, categoria FROM posts WHERE dataCadastro BETWEEN DATEADD(year,-1,GETDATE()) AND GETDATE() ORDER BY dataCadastro DESC"; The problem is that I need this query to...
asked by 22.01.2018 / 17:30
1
answer

error Migrations C # MVC

I created a Financial Controller, but when I click on the menu to list it returns the error:    Invalid object name 'dbo.Movimentacaos'. Why did you get this name? It was meant to be Movimentacoes . PS: I already added in my cont...
asked by 15.06.2016 / 05:00
1
answer

Query the database through a text box

Hello, I'm currently in a part of a project where I have to search the database through a text box. For example I searched for "Joseph" and returned all the data contained in the database with the name "Joseph". You could also search for "Traver...
asked by 15.05.2017 / 11:10