Questions tagged [stored-procedures]

A subroutine available to applications accessing a relational database system.

Filter by
Sorted by
Tagged with
1735votes
32answers
2.3mviews

Insert results of a stored procedure into a temporary table

How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [temp table]? Select all data from BusinessLine into tmpBusLine works fine. select * into ...
user avatar
  • 20.4k
989votes
24answers
1.9mviews

Search text in stored procedure in SQL Server

I want to search a text from all my database stored procedures. I use the below SQL: SELECT DISTINCT o.name AS Object_Name, o.type_desc FROM sys.sql_modules m INNER JOIN ...
user avatar
  • 11.2k
930votes
21answers
717kviews

Function vs. Stored Procedure in SQL Server

I've been learning Functions and Stored Procedure for quite a while but I don't know why and when I should use a function or a stored procedure. They look same to me, maybe because I am kinda newbie ...
user avatar
  • 76k
505votes
18answers
583kviews

List of Stored Procedures/Functions Mysql Command Line

How can I see the list of the stored procedures or stored functions in mysql command line like show tables; or show databases; commands.
user avatar
  • 14.7k
476votes
19answers
719kviews

Select columns from result set of stored procedure

I have a stored procedure that returns 80 columns, and 300 rows. I want to write a select that gets 2 of those columns. Something like SELECT col1, col2 FROM EXEC MyStoredProc 'param1', 'param2' ...
user avatar
  • 5,730
431votes
7answers
557kviews

SQL Server SELECT into existing table

I am trying to select some fields from one table and insert them into an existing table from a stored procedure. Here is what I am trying: SELECT col1, col2 INTO dbo.TableTwo FROM dbo.TableOne ...
user avatar
  • 4,487
396votes
14answers
1.1mviews

How to SELECT FROM stored procedure

I have a stored procedure that returns rows: CREATE PROCEDURE MyProc AS BEGIN SELECT * FROM MyTable END My actual procedure is a little more complicated, which is why a stored procedure is ...
user avatar
371votes
22answers
746kviews

How do I find a stored procedure containing <text>?

I need to search a SQL server 2008 for stored procedures containing where maybe the name of a database field or variable name.
user avatar
  • 16.3k
338votes
13answers
470kviews

How to pass an array into a SQL Server stored procedure

How to pass an array into a SQL Server stored procedure? For example, I have a list of employees. I want to use this list as a table and join it with another table. But the list of employees should ...
user avatar
  • 7,645
329votes
12answers
849kviews

SQL Server Insert if not exists

I want to insert data into my table, but insert only data that doesn't already exist in my database. Here is my code: ALTER PROCEDURE [dbo].[EmailsRecebidosInsert] (@_DE nvarchar(50), @_ASSUNTO ...
user avatar
319votes
16answers
621kviews

How to check if a stored procedure exists before creating it

I have a SQL script that has to be run every time a client executes the "database management" functionality. The script includes creating stored procedures on the client database. Some of these ...
user avatar
  • 3,275
317votes
17answers
569kviews

What is a stored procedure?

What is a "stored procedure" and how do they work? What is the make-up of a stored procedure (things each must have to be a stored procedure)?
299votes
12answers
227kviews

SQL Server: Query fast, but slow from procedure

A query runs fast: DECLARE @SessionGUID uniqueidentifier SET @SessionGUID = 'BCBA333C-B6A1-4155-9833-C495F22EA908' SELECT * FROM Report_Opener WHERE SessionGUID = @SessionGUID ORDER BY ...
user avatar
  • 232k
289votes
14answers
931kviews

How to execute a stored procedure within C# program

I want to execute this stored procedure from a C# program. I have written the following stored procedure in a SqlServer query window and saved it as stored1: use master go create procedure dbo....
user avatar
  • 12.9k
286votes
22answers
525kviews

How to call Stored Procedure in Entity Framework 6 (Code-First)?

I am very new to Entity Framework 6 and I want to implement stored procedures in my project. I have a stored procedure as follows: ALTER PROCEDURE [dbo].[insert_department] @Name [varchar](100) ...
user avatar
  • 3,163

15 30 50 per page
1
2 3 4 5
2371