sql server - T-SQL Custom Data Type as input parameter for stored procedure -


i'm quite new t-sql, i'm struggling input parameter stored procedure.

i want pass list of salesareas stored procedure. salesarea can have several countryids , bool values, imagine class in c#.

i started create own data type pass stored procedure:

create type tidlist table  (     id int null ); go  create type tsalesarea table (     countryids tidlist null,     islargeclient bit null,     issmallclient bit null, ); go 

in stored procedure want pass in list of tsalesareas:

@salesareas tsalesarea readonly 

the problem: cannot use tidlist datatype tsalesarea.

if insert 2 sales areas (1: countryids 3,5; 2: countryid 7), this:

id | salesareaid | countryid  ---+-------------+----------- 1  |     1       |     3 2  |     1       |     5 3  |     2       |     7 

do know how solve issue?

thanks!

you can not use table type column (it table type) in sql server.

instead, create tsalesarea columns needed express desired input.

create type tsalesarea table (     saleareaid int not null   , countryids int not null   , islargeclient bit null   , issmallclient bit null ); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -