-
Notifications
You must be signed in to change notification settings - Fork 0
/
manual _ASSET_QUANTITY.sql
90 lines (55 loc) · 2.08 KB
/
manual _ASSET_QUANTITY.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
--SELECT ast_id, assetqty, invoicenumber, asset_cost, asset_accessory, asset_type,assetname,assetdesc,loc_id, subloc_id, group_id,
--subgroup_id,facility_id
--INTO #TEMP_HD
--FROM hardware_register
----------------------------------
UPDATE #TEMP_HD
SET asset_cost=Rate
from #TEMP_HD
join fidility...consolidated$ a
on a.sno=ast_id
update sublocation_master
set subloc_code=ISNULL ([CODE],'NA')
FROM sublocation_master
join fidility...consolidated$ a
on subloc_name=a.[SITE]
SELECT COUNT (*) FROM sublocation_master
-------------------------------------
select sum ( asset_cost) from #TEMP_HD
where assetqty=3
select * from hardware_register
--truncate table hardware_register
select * into #hd from hardware_register
--SELECT asset_table
--select *from #hd
--insert into hardware_register
--(invoicenumber, asset_cost, asset_accessory, asset_type,assetname,assetdesc,loc_id, subloc_id, group_id,
--subgroup_id,facility_id )
--select invoicenumber, asset_cost, asset_accessory, asset_type,assetname,assetdesc,loc_id, subloc_id, group_id,
--subgroup_id,facility_id from #hd --from hardware_register
select assetqty, count(*) as ct , assetqty*count(*) as atct from #temp_hd
group by assetqty order by assetqty
select sum( asset_cost) from #temp_hd
use fidility_new
select assetqty, count(*) as ct , assetqty*count(*) as atct from #temp_hd
group by assetqty order by assetqty
select sum (asset_cost) from hardware_register
select count(*) from hardware_register
--truncate table hardware_register
--DECLARE @j int = 0
--WHILE( @j < 1)
--BEGIN
DECLARE @i int = 0
WHILE( @i < 95)
BEGIN
SET @i = @i + 1
/* your code*/
insert into hardware_register(invoicenumber, asset_cost, asset_accessory, asset_type,assetname,assetdesc,loc_id, subloc_id, group_id,
subgroup_id,facility_id )
select invoicenumber, asset_cost, asset_accessory, asset_type,assetname,assetdesc,loc_id, subloc_id, group_id,
subgroup_id,facility_id
from #temp_hd
where assetqty=95
END
--END
---------