Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PROC How to store the results of a Proc in a Variable
--/////////////PROCS////////////////////////////////////////////////// CREATE PROCEDURE sp_getAllAnimals ( @output int OUTPUT ) AS SET @output = (SELECT legs FROM animals WHERE animal = 'cat'); GO -- ///////////SCHEMA/////////////////////////////////////////////////// CREATE TABLE Animals (animal varchar(255), legs int, colour varchar(255)) ; CREATE TABLE ObjectPermissions (animal varchar(255), permission varchar(255), record int, test1 varchar(255), test2 varchar(255), test3 varchar(255) ) ; INSERT INTO Animals (animal, legs, colour) VALUES ('cat', 4, 'red'), ('bird', 2, 'yellow'), ('dog', 4, 'red'), ('deer', 4, 'red'), ('fish', 0, 'blue'), ('dingo', 4, 'yellow') ; select * from animals -- //////////////////////////////////////////////////////////////////// declare @legsVar int; EXEC sp_getAllAnimals @legsVar OUTPUT select * from animals where legs = @legsVar
run
|
edit
|
history
|
help
0
SS Sqlsvr2014 practice
Función Borrar carácter inicial repetido
tt
Changing URLs in a SQL table
ElaineBrown**
my sql2
Recursive cte (common table expression)
SQL_Joins_RankingFunctions
a
Mc170404738