Questions tagged as 'sql'

2
answers

How to create composite primary key in SQL?

I would like to know how to create a composite primary key in a weak relationship. I mean, I create the two relationship tables and I do not know how to "pull" the primary key for the weak table. Should I pull it as foreign key before and onl...
asked by 13.10.2015 / 20:23
1
answer

XML for Database Columns

I have a table that holds an XML in one of its columns, however I need to do a select by placing each XML item in a column. The problem is that I do not want to create another table, I want something, even if it is temporary, just to make it eas...
asked by 08.10.2015 / 20:28
1
answer

Get data from a column in the database to a variable

In a part of my code I have the handling of an exception that uses this message. //Grava log com sucesso da importação fundo.registerLog(Resources.MensagemSucessoImportacao); The message is inside a Resource file, however it is concatena...
asked by 04.06.2015 / 21:08
1
answer

Calculation of time logged in SQL

I have a system where user logs in and out of the tool several times in the day during their working hours. I need to calculate the amount of time it was logged: The columns LOGOUT and LOGIN are in seconds. SELECT DATA,USUARIO...
asked by 07.08.2015 / 01:20
1
answer

Return the data from one table if it does not exist in another

I have an environment where there are two forms of login and tables "Users" and "Establishments", these tables are very similar and I need to return this query based on the email typed in the login form. I'm trying to return by selecting direc...
asked by 22.03.2015 / 19:32
2
answers

count how many days a date range has in another date range

Good morning, I'm doing a query (mysql) and I have four dates periodo1inicio , periodo1final , periodo2inicio and periodo2final . I need to count how many days of period 2 is contained in period 1. Can anyone help me...
asked by 26.02.2015 / 14:42
1
answer

How to upload in PHP data coming from a Form with support for text and an image?

In my project I have on a page a form to collect data that will be inserted in the database and in a folder of the server. My problem is that in this form I have a support for uploading images. Then in the PHP part to move this information to th...
asked by 25.03.2015 / 12:35
1
answer

Insert table data with foreign key

Knowing that I have a table with the fields: [ARQUIVO_GUID] ,[XARQUIVO] ,[TAG] ,[EXTENSAO] ,[URL] ,[IS_STREAM] [ULT_ARQUIVO_VERSAO_GUID] FK [TIPO_DE_ARQUIVO_GUID] FK [DIRETORIO_GUID] FK The last 3 fields are foreign keys to other tables, h...
asked by 05.02.2015 / 21:56
1
answer

IF in StoredProcedure within a select, remove sp_executesql @query

I have a StoredProcedure that unfortunately only because of an IF it stopped being a select and turned everything into a VARCHAR statement and then I execute it, losing one of the main benefits of MSSQL being compiled. I modified SP just to...
asked by 16.01.2015 / 12:24
1
answer

How to show related table data in an organized way by topics

I have a question in SQL that is as follows: I have two tables, the parent table, and the daughter table, where the daughter table receives the id of the parent table as foreign key, however, I do not know how to show the data entered in...
asked by 08.01.2015 / 18:37