Questions tagged as 'sql'

1
answer

Select in SQL Server with index

I would like to know if it is possible to make a select in the Sql Server of a table that does not have an index column, but in this select it presents a sequential index column in ascending order. Ex. Table: Letters Coluna D E S And maki...
asked by 27.08.2014 / 17:08
2
answers

Fields Currency 1,99 saving as 199 in Access

I'm having a problem when I'm going to save the data from currency or decimal fields to an Access database using the Visual Studio components. When saving something of type 1.99m or has 1,99 in textbox the data goe...
asked by 23.08.2014 / 16:40
2
answers

I can not get a foreign key in PHPMYADMIN

I have my bank already created in phpmyadmin, there are two tables, payments and students. I've seen several tutorials and read various ways how to put a foreign key ( fk_alunos ) of student_id in my payments table, nothing works. Tabl...
asked by 18.09.2018 / 16:42
1
answer

Select with PIVOT always returns null

I'm trying to make a query using the pivot based on this link insert the description of the link here , but without success, because it always returns 2 lines Null: Query: DECLARE @registros as table ( ID int, Campo varchar(250),...
asked by 18.10.2018 / 00:06
1
answer

How to sum values in sql in column

I have the following sql code: select PS.PatSldBemValResidAnt ,PS.PatSldBemValDepAcum ,Sum(PS.PatSldBemValDep) PatSldBemValDep ,Sum(PS.PatSldBemValResid) PatSldBemValResid from Pat_Saldo_Bem as PS With(Nolock...
asked by 19.10.2018 / 16:55
1
answer

Query joining two tables and populating fields conditionally

I'm a beginner in SQL and would like to know if they could help me with an issue. I have two tables, one is Cadastro_Func and the other CadastroFocal . 'Cadastro_Func' has the columns: 'Nickname' 'Name' 'Cargo' 'Register_Foca...
asked by 17.10.2018 / 05:42
3
answers

Call database function that receives a list as parameter

People like I do the following ... involves database (Postgres SQL) and JPA, I want to create a database function that gets a list of ids as parameter and make a query cm in the WHERE IN (. ..). In JPA how do I call this function, and how do I p...
asked by 20.10.2018 / 15:21
1
answer

How to view the columns of a system view in SQL Server?

Well I come from the Oracle culture and want to learn about SQL Server. I would like to know how I see the columns of a system view, for example: I tried with sp_help teste.INFORMATION_SCHEMA.ROUTINES and desc teste.INFORMATIO...
asked by 05.08.2018 / 17:17
3
answers

Select the first result of each conversation

How can I select the first line of each conversation for a specific user where to_id = 1 . The big problem is when the first message changed from the conversation does not have top_id = 1 and ends up listing the next message in t...
asked by 05.08.2018 / 22:30
1
answer

Query Oracle SQL - Subtract hours

Hello, I am a beginner in SQL and I have a mortal doubt. This query is to parse a running log on a basis of my company. The problem is that the OS time zone is +0.00 which creates incorrect logs in my log (you can not make this change, so I've a...
asked by 08.08.2018 / 21:46