SQL Script Error


hi, have syntax error in this, please advise

select  #temp.*,

select  distinct inv_id,
            (
                 select    '  ' + inv_id + ' (' + inv_type + ') '
                 oth_inv_details a
                 where    a.inv_id = b.inv_id
                 xml path('')
             )inv_type_description,
             sum(inv_qty) over(partition inv_id) totalqty
temp
from  oth_inv_qty_loc b;
select temp.*,
        case when a.inv_usage = 0 0            
        else cast ((t.totalqty) / a.inv_usage int)     
        end dsb
 from   oth_inv_details
 join temp t on a.inv_id = t.inv_id
       1=1  or t.totalqty <= a.inv_rol

try following...

select  distinct inv_id,              (                   select    '  ' + inv_id + ' (' + inv_type + ') '                   oth_inv_details                      a.inv_id = b.inv_id                   xml path('')               ) inv_type_description,               sum(inv_qty) over(partition inv_id) totalqty #temp oth_inv_qty_loc b;  select t.*,        case when a.inv_usage = 0 0                    else cast ((t.totalqty) / a.inv_usage int)             end dsb   oth_inv_details  join #temp t on a.inv_id = t.inv_id 1=1  or t.totalqty <= a.inv_rol  -- clean-up temp table drop table #temp


/neil moorthy - senior sql server dba/developer (mcitp (2005/2008), mcad, itilv3, oca 11g) please click mark answer button if post solves problem




SQL Server  >  SQL Server Express



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........