Last active
December 21, 2015 03:39
-
-
Save sixfeetover/6244243 to your computer and use it in GitHub Desktop.
Pass table variable as a procedure variable in SQL Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create type GKCTable as table ( | |
id int, | |
description varchar(255) | |
) | |
go | |
create procedure dbo.PrintGKC(@gkc_table GKCTable readonly) | |
as | |
select * | |
from @gkc_table | |
go | |
declare @grades GKCTable | |
insert @grades(id, description) | |
values (0, 'None'), | |
(1, 'First Grade') | |
exec PrintGKC @grades | |
drop procedure dbo.PrintGKC | |
drop type GKCTable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment