Questions tagged as 'sql-server'

1
answer

PostGre - Field Id (Integer) of a table can go from 1 to how much?

I have a table in PostGre whose Id field is of type Integer and primary key. As records are being saved, numbering ranges from 1 to how much? I'm used to the Dataflex database, where table records (by default) start from 1 and go up to 999999...
asked by 20.06.2018 / 15:04
2
answers

Set default value when creating a table in SQL

I am studying SQL Language and am having some problems in creating tables, I can not set a default value in a column, whenever I apply it indicates a syntax error. Can someone help me? I have no idea what is happening ... (If there are more erro...
asked by 01.09.2018 / 00:38
1
answer

How to select only 1 record per month with SQL

I have a sales table and would like to select customer sales, but if the customer made more than one sale per month, I would like it to bring the older one just, how could I do that? I do not have SQL code to provide because I do not know whe...
asked by 07.05.2018 / 17:29
1
answer

How not to repeat data in this query

I made this query, which will compose a view. SELECT DISTINCT US.EMPLOYEESTATUS ,US.EMPLOYEEID ,US.EMPLOYEEFIRSTNAME + ' ' + US.EMPLOYEEMIDDLENAME + ' ' + US.EMPLOYEELASTNAME AS FULLNAME ,US.GRADE ,SO.SOLICITATIONID ,...
asked by 13.09.2018 / 13:39
2
answers

Problem with CASE WHEN SQL-SERVER

SELECT CASE WHEN VALOR > 0 THEN VALOR ELSE "Não tem" END AS NOMECOLUNA FROM BLABLABLA I'm having an error where it's not possible to convert "does not have" to int. The issue is that I wanted it to return written that it does not have wh...
asked by 27.04.2018 / 14:17
2
answers

Sum on a Pivot Table

I'm learning how to use tables with PIVOT in Sql-Server. I have a table with the item name, the vendor name, and the customer id. Item | Customer | ID Rep Pen Set | 1001 | Richard Binder | 25092 | Nick Pen Set | 5149...
asked by 30.04.2018 / 06:57
2
answers

My software in C # with SQLEXPRESS database LocalDB does not open on another PC, even installing all dependencies

1 - My software in C # with SQLEXPRESS database LocalDB does not open on another PC, even installing all dependencies. NOTE: In my PC Development works perfectly. 2 - Programs that I have already installed on the Client: Microsoft SQL Server...
asked by 23.03.2018 / 21:40
1
answer

How to format the numbers directly through SQL

Gentlemen, my numbers are coming out unformatted when I make the select directly in the bank, they are coming out as follows: REALIZADO META 61274436,2090003 80000000,00 How can I make them readable for anyone to interpret?...
asked by 30.07.2018 / 20:50
1
answer

How to create a single index in a table so that it only has a record with a specific value in SQLServer

Hello, I am creating a data structure in SQLServer and I have the following situation: I have a list of contact types (people, public, commercial, etc ...) This list can be changed by the user, but it can only have 1 element as default....
asked by 30.07.2018 / 16:18
1
answer

List tables that have trigger

Is there any way to know which tables have at least 1 trigger? For example, I have a system with 10,000 tables, and I would like to know which one has a trigger.     
asked by 23.04.2018 / 20:10