Skip to content

Instantly share code, notes, and snippets.

@radityopw
Created March 1, 2016 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radityopw/c5088d1870973432fd6b to your computer and use it in GitHub Desktop.
Save radityopw/c5088d1870973432fd6b to your computer and use it in GitHub Desktop.
use tempdb
go
-- membuat stored procedure
CREATE PROCEDURE dbo.usp_mencoba1 @min_len_middle_name int , @max_len_middle_name int, @jml int out
as
begin
select @jml = count(*) from AdventureWorks2012.Person.Person where len(middleName) between @min_len_middle_name and @max_len_middle_name
end
go
-- menjalankan stored procedure dan melihat hasilnya
declare @jml_person int
exec usp_mencoba1 3,100,@jml_person output
print @jml_person
exec usp_mencoba1 2,100,@jml_person output
print @jml_person
exec usp_mencoba1 5,100,@jml_person output
print @jml_person
-- menghapus
DROP PROCEDURE [dbo].[usp_mencoba1 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment