java - JDBC execute big T-SQL query -


i have big sql script creating temp tables , inserting data in them selecting data tables, many inserts,

set @enddate = dateadd(dd, -1, @enddate);  declare @enddateplusoneday smalldatetime set @enddateplusoneday = dateadd(dd, 1, @enddate);  create table #cntrs (     contractid             dsidentifier,     contractdatefrom       dsdatetime,     contractnumber         dsvarfullname40,     contractclientid       dsidentifier,     contractclientname     varchar(500),     creditdateto           dsdatetime,     amount                 dsmoney,     loandept               dsmoney,     pledgerate             dsmoney,     collatval              dsmoney,     warrantytype           dsfullname,     warrantynumber         varchar(20),     warrantydate           dsoperday,     warrantyqty            dsmoney, )  insert #cntrs select c.contractid,        cc.creditdatefrom,        c.number,        ti.institutionid,        (            case                  when ti.propdealpart = 0 ti.name + ' ' + ti.name1 + ' ' +                      ti.name2 + ' '                 else ti.name            end        )              contractclientname,        cc.creditdateto,        c.amount,        0              loandept,        70             pledgerate,        0              collatval,        ''             warrantytype,        ''             warrantynumber,        '19000101'     warrantydate,        0              warrantyqty   datatable1 c(nolock)        inner join datatable2 cc(nolock)             on  c.contractid = cc.contractcreditid        inner join datatable3 o(nolock)             on  c.contractid = o.id             , o.objecttypeid = 105        inner join datatable4 p(nolock)             on  o.currprotocolid = p.protocolid        inner join datatable5 t(nolock)             on  p.transitionid = t.transitionid        inner join datatable6 n(nolock)             on  t.targetstateid = n.nodeid        inner join datatable7 ti with(nolock)             on  ti.institutionid = c.institutionid  1 = 1        --  , @branchid in (0, isnull(nullif(c.branchextid, 0), c.branchid))        , n.brief in ('Предоставл', 'НеОплВовр', 'Завершен')        , cc.creditdatefrom between @startdate , @enddate order        cc.creditdatefrom   if object_id('tempdb..#accinner') not null     drop table #accinner  create table #accinner (     contractid     numeric(15, 0),     resourceid     numeric(15, 0) )  create unique index x1 on #accinner(contractid)   declare @depparentid        dsidentifier,   -- Субконто КатегорияСредств         @deprepaymentid     dsidentifier,   -- Субконто ТипОперВУ - Упл/Погаш         @depaccrualid       dsidentifier   -- Субконто ТипОперВУ - Выд/Нач  select @depparentid = d.departmentid   tdepartment d(nolock index = xak3tdepartment)  d.brief = 'КатСрдств'   update c set    c.collatval = c.loandept * (c.pledgerate / 100)   #cntrs c   select *   #cntrs order        contractdatefrom 

i need execute t-sql code in 1 batch query. plan read t-sql code file string , execute string @ once.

how can jdbc ms sql server?

you can save t-sql code mssql stored procedure , execute using jdbc callablestatement.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -