Questions tagged as 'stored-procedures'

2
answers

Error trying to remove a temporary table [closed]

I have a service where you load data from an ERP into a DW. Because the data source is SQL Server 2008 R2 10.50.1600.1 and the destination server MS SQL Server 2008 10.0.5512.0 SP3. The service executes a stored procedure that generates tem...
asked by 18.01.2016 / 13:26
3
answers

What is the difference between a View and a Stored Procedure in SQL? [duplicate]

I have encountered Views in SQL and also with stored procedures. I would like to understand better, what is the difference between a view and a stored procedure and what are its purposes? Would it be possible to provide a practical case for...
asked by 27.08.2018 / 15:46
2
answers

varchar parameter in Store Procedure

I have a store procedure in mysql as follows: CREATE PROCEDURE nome_procedure(campo VARCHAR(15)) BEGIN SELECT id as id, campo as value FROM tabela etc etc etc...; END $$ However, since the parameter I am passing is of type VARCH...
asked by 22.10.2014 / 14:24
1
answer

How to put quotes in a variable for MySQL query

I'm doing a procedure, I need to put a varchar variable in the query, but it does not go with the single quotation marks, I've tried concatenating it or something like that, but it's no use: set @comando := concat(@comando, '"'); //ao contrári...
asked by 09.10.2018 / 21:33
2
answers

SQL Command in String MySQL

I'm doing a procedure that holds a select in a varchar variable. Now I need to run this sql command, how do I do this? I'm using MySql. Procedure: delimiter $$ create procedure eixos_caminhao (in numeroEixos int) declare comando varchar(500);...
asked by 09.10.2018 / 17:42
1
answer

Sql Server Stored Procedures [closed]

I'm starting to develop an application, basically it's a business management control. The application will issue NFC-e, NFe, will control inventory, financial and etc., the database will be hosted on Azure. I started by modeling the database and...
asked by 30.09.2016 / 15:34
1
answer

Show alert message without causing an exception

I would like to display an alert message to the user without causing an exception in the procedure. I am using SQL Server. So I can not use RAISERROR , nor PRINT , as it is not shown to the user. Is there a way to display an alert...
asked by 21.11.2016 / 13:45
0
answers

Select with SUM until sum B is equal to or less than A

I have two tables, products and lots: Products codigo qtdatual Lots codigo qtdlote validade A% example would be: SELECT P.CODIGO, L.QTDLOTE, L.VALIDADE FROM LOTES L INNER JOIN PRODUTOS P ON(P.CODIGO = L.CODIGO) WHERE (P.QTDATU...
asked by 17.08.2018 / 15:05
2
answers

Stored Procedure for inserting log data

I need to create a Stored Procedure in my SQL Server database. The purpose of this Stored Procedure is to write data to a Log table, which has three fields: date, time, login ID. Date and time would be the time of login, while the Login ID co...
asked by 29.02.2016 / 13:14
2
answers

Condition for INSERT INTO

I need SQL to check if there is any value equal to 1, 2 or 3 in the '@variavel' sent; If it is green enter the value 1, otherwise enter the value 0. Note: the table and column can be given as example as fictitious.     
asked by 24.10.2018 / 14:16