Questions tagged as 'sql'

2
answers

Declare scalar variable in Stored Procedure

I have the following SP and it marks me the following error in the SP:    SQLState = 37000, NativeError = 137 Error = [Microsoft] [SQL Server]   Native Client 10.0] [SQL Server] Must declare the scalar variable   "@Today". SQLState = 37000, N...
asked by 15.01.2018 / 17:39
1
answer

Call sequence in a create table stored in a variable

Hello have the following problem: I have created a sequence in a trigger, and then dynamically instantiate it by create statements of tables in the same trigger. When I try to put NEXTVAL('secuencia') the single quotes tell me the variabl...
asked by 17.01.2018 / 21:08
1
answer

Error executing the DBCC SHRINKFILE command in the Log File of a SQL Server database

The following sql code for the compaction of the log: use My_dabase go declare @arch_log sysname set @arch_log =(select name FROM SYSFILES where fileid = '2') select name from sysfiles ALTER DATABASE My_database SET RECOVE...
asked by 17.01.2018 / 23:26
0
answers

Text field as400 are seen as varbinary in SQL SERVER

I have an AS400 Server (IBM i) for Linked Server to SQL, the problem is that some values (text type (varchar)) are not displayed correctly, something like this is seen in the result of the query by OpenQuery 0xD4C5C4C9C140404040404040404040...
asked by 22.12.2017 / 17:54
1
answer

Remove IDs without repeating a table with SQL

see, I have a table in SQL called messages , this table contains 2 IDs, one of the receiver and another of the issuer, the date and the message itself. I try to extract with what people have spoken, for example, the member with id 1 but when...
asked by 16.01.2018 / 18:27
0
answers

Java: method that stores the parameters [closed]

I'm doing a DAO and I need to insert in two different tables in the BDs. I know I can do it with Autocommit . But the idea is to go through the different inserts as a parameter and use the Autocommit in the method.  The code simplif...
asked by 28.12.2017 / 17:58
0
answers

I have two tables table1 and table2, I want to enter the data from table1 in table2, but there are duplicates

I added a new field to the table 1 of the name delete to mark the ones that are duplicates and that are marked in 1 with the following code, but when you delete them and try to upload them, they still appear duplicates select count(*) from tab...
asked by 05.01.2018 / 21:07
1
answer

Substitute of% ROWTYPE in SQL Server

Hi, I would like to know if there is a substitute for the% ROWTYPE statement in SQL SERVER I would like to create something like that but I can not find how to do it PROCEDURE mostrar(pdni IN VARCHAR2) is tupla poblacion_tv%ROWTYPE; BEGIN...
asked by 05.01.2018 / 21:11
1
answer

crossing 2 tables and get the last record by date in sql

query I have 2 tables A and B; IN THE TABLE I REQUIRE TO BRING THE FIELD DATE_RESPOSED FROM TABLE B, THE CONDITION IS BY THE LAST DATE OF RESPONSE OF TABLE B TABLE A ID - DATE_HEADING - PRODUCT 3349793 - 2018-01-07 18:08 - A 33565...
asked by 26.02.2018 / 01:44
2
answers

Query in PostgreSQL with filter in 2 different columns

I have a problem when doing a select with filters to several columns. I have a table with different age groups (days, months, years) and I need to make a consultation where only people who are younger than 2 bring me but the months are greater t...
asked by 28.11.2017 / 14:43