c# - How to get List<ColumnType> in SQL Server? -


i have establishment table shown below,

estabid    name                      checkindate 114883  marconfort griego hotel   2011-09-28 00:00:00.000 114910  royal costa hotel         2011-10-18 00:00:00.000 114912  roc flamingo hotel        2011-11-22 00:00:00.000 114912  roc flamingo hotel        2011-11-29 00:00:00.000 114912  roc flamingo hotel        2011-12-06 00:00:00.000 114912  roc flamingo hotel        2011-12-13 00:00:00.000 114912  roc flamingo hotel        2011-12-20 00:00:00.000 114894  gran hotel blue sea       2012-01-17 00:00:00.000 114894  gran hotel blue sea       2012-01-31 00:00:00.000 

suppose, if want structure query result like,

response  : {   [    estabid: 114912,    name: 'roc flamingo hotel',    checkindates : [2011-11-22 00:00:00.000, 2011-11-29 00:00:00.000, 2011-12-06 00:00:00.000, 2011-12-13 00:00:00.000, 2011-12-20 00:00:00.000]    ,... ] } 

is, there recommended way achieve structure sql stored procedure or c# + sql combination?

ps: heard, sql server not support list

any response highly appreciated.

this might work. should read this article specific needs.

this query return result comma separated check in dates can store in collection of establishment class.

select es1.estabid , es2.name ,  (  select @checkindatelist   = coalesce(@checkindatelist +',' ,'') + checkindate                      establishment es2   es2.estabid = es1.estabid , es2.name = es1.name ) checkindates  establishment es1 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -