Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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