Instantly share code, notes, and snippets.

Embed
What would you like to do?
use tempdb
go
-- membuat table dan stored procedure
create table radityo_coba1(kunci varchar(255),value text);
GO
CREATE PROCEDURE dbo.usp_mencoba1 @min_len_middle_name int = 3
as
begin
declare @jml_person int
select @jml_person = count(*) from AdventureWorks2012.Person.Person where len(middleName) >= @min_len_middle_name
insert into radityo_coba1(kunci,value) values ('jumlah person with min len '+cast(@min_len_middle_name as varchar),cast(@jml_person as varchar))
end
go
-- menjalankan stored procedure dan melihat hasilnya
exec usp_mencoba1
exec usp_mencoba1 2
exec usp_mencoba1 5
select * from radityo_coba1
-- menghapus
drop table radityo_coba1
DROP PROCEDURE [dbo].[usp_mencoba1 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment