sql - Inserting data into table variable -


i want know if it's possible insert data table variable select query. when using variable table before have inserted values , typed them myself.

i have come following select query displays latest comment repair order. returns 37 records , wanted know if it's possible insert variable table.

select      a.ch_repref, a.ch_date, a.ch_crtime,     b.[latest customer comment], a.ch_cruser, a.ch_ccommnt     (select          ch_repref,          max(ch_repref1) [latest customer comment]              dbo.v_csrpch              ch_ccommnt not null          , ch_ccommnt not 'x'     group          ch_repref) b,    (select          ch_repref, ch_date, ch_crtime, ch_repref1,          ch_cruser, ch_ccommnt, ch_account              dbo.v_csrpch)      ch_repref1 = [latest customer comment]      , ch_account = 'ddchc'  

i have started table variable following, stuck whether it's possible fill data returned select query:

declare @tbl_last_customer_comment table (ch_repref nvarchar(10), ch_date smalldatetime, ch_crtime nvarchar(8), latest int, ch_cruser nvarchar(8), ch_ccommnt text) 

just 'constant' table-

insert @tbl_last_customer_comment select a.ch_repref, a.ch_date, a.ch_crtime,b.[latest customer comment],a.ch_cruser,a.ch_ccommnt (select ch_repref, max(ch_repref1) [latest customer comment] dbo.v_csrpch ch_ccommnt not null , ch_ccommnt not 'x' group ch_repref) b, (select ch_repref, ch_date, ch_crtime,ch_repref1, ch_cruser, ch_ccommnt, ch_account dbo.v_csrpch) ch_repref1 = [latest customer comment] , ch_account = 'ddchc' 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -