I have the following TSQL table variable:
declare @NumDaysMonth table
(
month_id smallint,
num_days smallint
)
I just want a quick look-up for the number of days in each month. How can I initialize this table like a C array:
int numDaysMonth[] = {31, 28, 30, ... , 31};
Well you can’t. The best you can do is something like this
Then retrieval might be something like
SQL Fiddle Demo