Skip to Content
-2
Sep 23 at 03:10 PM

BUSQUEDA FORMATEADA - UNION - DECIMALES

52 Views Last edit Sep 23 at 04:50 PM 2 rev

Que tal.

Estoy haciendo una búsqueda formateada con SAP B1 y SQL Server. Mi consulta ya realiza lo que necesito solo que mis campos numéricos Cantidad, Costo promedio x unidad y Costo aparecen en 2 decimales y esto es por el uso del UNION ya que su naturaleza es mostrar solo 2 decimales según . ¿Podrán ayudarme a encontrar una forma de obtener estos valores numéricos a 6 decimales que son los que necesito?.

screenshot-1.png

Anexo mi query

SELECT T0.[Code], T2.[ItemName], T0.[PlAvgSize], T0.[ToWH], T1.[Code], T1.[ChildNum], (Select A.[ItemName] from oitm A Where A.ItemCode=  T1.Code)[Descripcion],T1.[Quantity] AS 'Cantidad', T1.[Warehouse], T3.[AvgPrice] AS 'Costo promedio X Unidad', (T1.[Quantity] * T3.[AvgPrice]) AS 'Costo', (select convert (DECIMAL,10,6),T1.[Quantity])
FROM
OITT T0  INNER JOIN ITT1 T1 ON T0.[Code] = T1.[Father] INNER JOIN OITM T2 ON T0.[Code] = T2.[ItemCode] INNER JOIN OITW T3 ON T1.[Code] = T3.[ItemCode]
WHERE T0.[Code] =[%0] and  T3.[WhsCode] ='ALMPRI'

UNION (SELECT T0.[Code], T2.[ItemName], T0.[PlAvgSize], T0.[ToWH], T1.[Code], T1.[ChildNum], (Select A.[ItemName] from oitm A Where A.ItemCode=  T1.Code)[Descripcion],T1.[Quantity] AS 'Cantidad', T1.[Warehouse], T3.[AvgPrice] AS 'Costo promedio X Unidad', (T1.[Quantity] * T3.[AvgPrice]) AS 'Costo', (select convert (DECIMAL,10,6),T1.[Quantity])
FROM 
OITT T0  INNER JOIN ITT1 T1 ON T0.[Code] = T1.[Father] INNER JOIN OITM T2 ON T0.[Code] = T2.[ItemCode] INNER JOIN OITW T3 ON T1.[Code] = T3.[ItemCode]
WHERE
T0.[Code] =[%0] and  T3.[WhsCode] ='ALMINT')
<br>

Attachments

screenshot-1.png (42.1 kB)