Update statement taking long time
Hi All,
The following query is taking too much time for update the 100000 records.
Please tell me how can this query time get reduced.
DECLARE
CURSOR cur IS
SELECT c.account_id FROM crm_statement_fulfilled_sid c;
BEGIN
FOR i IN cur LOOP
UPDATE crm_statement_fulfilled_sid a
SET a.rewards_expired = (SELECT abs(nvl(SUM(t.VALUE), 0))
FROM crm_reward_txns t
WHERE txn_date BETWEEN
(SELECT (decode(MAX(csf.procg_date) + 1,
NULL,
to_date('01-May-2011',
'DD-MM-YYYY'),
MAX(csf.procg_date) + 1))
FROM crm_statement_fulfilled csf
WHERE csf.procg_date < '01-aug-2012'
AND account_id = i.account_id) /*points_start_date_in*/
AND '01-aug-2012'
AND reason = 'RE'
AND t.account_id = i.account_id);
END LOOP;
END;Any help?
Sid
Hoek wrote:
Second: you're doing row-by-row (= slow-by-slow) processing.
See if you can rewrite your code into a single SQL UPDATE statement that will process an entire SET at once.Well to be nitpicking. The op already does a single big update. He just does it again and again and again for each account id. Each time completely overwriting the values from the last account id.
Similar Messages
-
Replication update statement takes long time
Hi Replication experts,
I have a issue and please suggest if my understanding and solution is correct.
We have a transactional replication setup for data warehouse, from today morning replication got huge latency so when I looked into it I saw the "sp_MSupd_< tablename >" was running for very long time and by this time it was running for 9 hours
still no data was updated, Latency went very high. What we feel is that the index maintenance was not done in subscriber also it was not replicated too. So due to high fragmentation the update statement could take very long.
As there was no error message or blocks found all we see is the update taking very long. So to avoid this we are planning to remove the index, as this is just data warehouse index maintenance is not required by removing we can gain some space too. Is this a
good Idea to implement?
When we ran profiler nothing was found, no error or alert logged.
Please let me know your suggestions
Thanks
Best Regards MougHi All,
The Issue we found to be is that a day before, new column was added to the table and 9000 rows were updated ... This caused the distributor to slow down the update operation as the index in subscriber(15 million rows) was updating every time a row
is updated.. So we suspect that adding a new column and updating it at the same time is the culprit..
But still am not convinced as per my understanding the distributor operates by comparing the primary key of publisher that was changed with the primary key of the subscriber and apply those change.. If that is the case why should it worry about the new column
added or the number of updates..
Also one strange thing is another table was also lagging behind in its operation ,though that table was updated with just 18 rows.. So in a nutshell the update operation was totally down by distributor operation on that day..
Can someone please shed some light on this, Replication is my favorite topic but now I got fear of it.. after failing to know what could be issue...
Best Regards Moug -
Update statement takes long time - Why so ?
Dear DBAs;
Daily update statement takes 20 mins. But today update takes more time.
What is the reason how to resolve ?
Thanks in advance ..8f953842-815b-4d8c-833d-f2a3dd51e602 wrote:
Dear DBAs;
Daily update statement takes 20 mins. But today update takes more time.
What is the reason how to resolve ?
Thanks in advance ..
More time? How much more? -
Update script taking long time....
Dear all,
I have to update more then 2 mil records in a table but below update script took whole day still did not finish, is there any other way to enhance this update statement.
update customer_table p
set P.ic_no = fn_change_iden_no_dirct(p.v_ic_no, p.ic_code)
where P.ic_no is not null
" fn_change_iden_no_dirct" is a finction which returns the correct ic_no?
BELOW IS THE COSTING OF THE ABOVE UPDATE SCRIPT
ID PID Operation Name Rows Bytes Cost CPU Cost IO Cost
0 UPDATE STATEMENT 2292K 34M 1192 1192
1 0 UPDATE CUSTOMER_TABLE
2 1 TABLE ACCESS FULL CUSTOMER_TABLE 2292K 34M 1192 1192
.....Thank youOne reason the update is slow is because Oracle will do two switches between the SQL engine and the pl/sql engine for each row that it has to process. Such a switch usually is very slow. In 11g you could profit from funcion result cache. But the best way would be not to use a user-defined pL/sql function.
I just noticed that you will do 4 context switches because inside of your function you do a not needed SELECT to get the length.
First thing I would do is replace
BEGIN
select length(trim(PI_INSTR))
into lv_length from dual;
...with
BEGIN
lv_length := length(trim(PI_INSTR));
...Here is a version where I tried to copy the logic from your function to the SQL statement. Also note that I tried to update only those rows that require a change.
starting point
update customer_table p
set P.ic_no = fn_change_iden_no_dirct(p.v_ic_no, p.ic_code)
where P.ic_no is not null
and P.ic_no != fn_change_iden_no_dirct(p.v_ic_no, p.ic_code)
changed logic
update customer_table p
set P.ic_no =
decode(p.ic_code
/* NEW IC part */
,'NEWIC', case when length(trim(p.v_ic_no)) = 12
then substr(trim(p.v_ic_no),1,6)||'15'||'999'||substr(trim(p.v_ic_no),12,1)
when length(trim(p.v_ic_no)) > 12
then substr(trim(p.v_ic_no),1,6)||'15'||'999'||substr(trim(p.v_ic_no),-(length(trim(p.v_ic_no)) -11))
when length(trim(p.v_ic_no)) between 8 and 11
then substr(trim(p.v_ic_no),1,6)||'15'||'999'
else p.v_ic_no
end
/* IC part */
,'UIC', case when length(trim(p.v_ic_no)) > 4
then substr(trim(p.v_ic_no),1,1)|| substr(trim(p.v_ic_no),4,1)||substr(trim(p.v_ic_no),3,1)||substr(trim(p.v_ic_no),2,1) ||substr(trim(p.v_ic_no),- (length(trim(p.v_ic_no)) -4))
else p.v_ic_no
end
/* else part */
,p.v_ic_no)
where P.ic_no is not null
and (p.ic_code in ('NEWIC','UIC') or p.v_ic_no != P.ic_no)
;Edited by: Sven W. on Jul 5, 2010 1:35 PM -
Insert Statement taking longer time
Hi,
One of my insert statement inside the procedure is taking more than 10secs to complete.
Scenario:
1. Having three tables e.g invoice table - invoice header, invoice Item and invoice attribute
2. These tables are loaded with data in the above specified order and they are not commited till all the data for an invoice gets inserted sucessfully.
e.g
a. Invoice header gets inserted first(one row)
b. Invoice Item second(will be in a loop with more than one row)
c. For every Invoice item an invoice attribute will be inserted
(Invoice Attribute has a FK column with a PK column in invoice item table column)
The problem is while inserting data into InvoiceAttribute it takes more than 10sec, IF the FK(mentioned above) is disabled insert statement is running fine.
note: Invoice Item table has 8.4million records
My assumption :
while inserting into Invoice attribute table the insert statement validated the FK with the invoice item table, since the new Inovice item id(PK column in invoice Item table) is not commited the insert statement takes time to validate the FK against (8.4million records)......
Please suggest me a solution.....................
Thanks in advance
NaveenPeriI'll try with a blind shot : The FK is likely missing an index, thus performing full table scan on invoice attribute each time you perform an insert on the invoice attribute table.
By default an FK doesn't have an index. You must create one manually.
If this turns out to be a missfire then please post a plan with statistics for the attribute insertion.
Message was edited by:
76°® -
Delete Statement taking long time
Can anyone help for the below query:
DELETE FROM apm_prod_mst_interface
WHERE plant_code= 'CAPL'
AND trunc(start_date) = '20-FEB-2008'
AND shift = p_mb_details.shift
AND formula_class = p_mb_details.formula_class
AND item_no = p_batch_details.item_no
AND line_no = p_mb_details.line_no
AND nvl(formula_no,'1') = NVL('ASCC1','1')
AND nvl(formula_vers,-1) = NVL(13,-1)
AND uom = 'KG'
AND NVL(routing_no,'-1') = NVL('SFSDF-2','-1')
AND NVL(routing_vers,0) = NVL(14,0)
AND NVL(plan_start_date,trunc(sysdate)) = NVL('20-FEB-2008',trunc(sysdate))
AND NVL(expct_cmplt_date,trunc(sysdate)) = NVL('20-FEB-2008',trunc(sysdate))
AND user_name = 'DUMMY'
AND schedule = 2
AND plan_qty > 0;
RegardsCheck the High Water Mark of the table!
If the table has lots of inserts & deletes all the time, the HWM may be 1000 miles away from the actual data (But Orcale will need to read all the blocks to determine if they are empty).
Has the table been analyzed recently?
Explain plan for the equivalent SELECT?
IF you have index'es on all the fields, then an update will take time, since it has to update 15-20 indexes.
I would:
1) Try to time just the SELECT (explain plan & autotrace)
2) Gather stats
3) SELECT again - and see if difference?
4) If not -> ALTER TABLE <name> MOVE (to fix HWM)
5) SELECT again
best regards
Mette -
Update ztable is taking long time
Hi All,
i have run the 5 jobs with the same program at a time but when we check the db trace
zs01 is taking long time as shown below.here zs01 is having small amount of data.
in the below dbtrace for updating zs01 is taking 2,315,485 seconds .how to reduce this?
HH:MM:SS.MS Duration Program ObjectName Op. Curs Array Rec RC Conn
2:36:15 AM 2,315,485 SAPLZS01 ZS01 FETCH 294 1 1 0 R/3
The code as shown below
you can check the code in the program SAPLZS01 include LZS01F01.
FORM UPDATE_ZS01.
IF ZS02-STATUS = '3'.
IF Z_ZS02_STATUS = '3'. "previous status is ERROR
EXIT.
ELSE.
SELECT SINGLE FOR UPDATE * FROM ZS01
WHERE PROC_NUM = ZS02-PROC_NUM.
CHECK SY-SUBRC = 0.
ADD ZS02-MF_AMT TO ZS01-ERR_AMT.
ADD 1 TO ZS01-ERR_INVOI.
UPDATE ZS01.
ENDIF.
ENDIF.
my question is when updating the ztable why it is taking such long time,
how to reduce the time or how to make faster to update the ztable .
Thanks in advance,
regards
SuniTry the code like this..
data: wa_zs01 type zs01.
FORM UPDATE_ZS01.
IF ZS02-STATUS = '3'.
IF Z_ZS02_STATUS = '3'. "previous status is ERROR
EXIT.
ELSE.
SELECT SINGLE FOR UPDATE * FROM ZS01
WHERE PROC_NUM = ZS02-PROC_NUM.
-- change
CHECK SY-SUBRC = 0.
ADD ZS02-MF_AMT TO wa_ZS01-ERR_AMT.
ADD 1 TO wa_ZS01-ERR_INVOI.
UPDATE ZS01 from wa_zs01.
ENDIF.
ENDIF.
And i think this Select query for ZS01 is inside the ZS02 SELECT statement,
This might also make slow process.
If you want to make database access always use Workarea/Internal table to fetch the data
and work with that.
Accessing database like this or with Select.... endselect is an inefficient programming. -
Delete statements are taking longer time
Hi All,
I have an issue with delete statement. below are my oracle DB details.
SQL>select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
I have a schema in the database which has 120 tables in it. The problem is, when the QA team is deleting the customers from customer table, it is running long time and haven't completed. this customer table have FK relation with other tables and have all the right indexes in place. then i have tried to identified the problem, why it is taking long time, and found that when they are running this delete query at the same time application is also running. the sessions created by application are locked most of the table and at the same time the delete session is also waiting for exclusive lock on those table. I given the same info to QA team and asked to stop the application when they deleting the customers. Then they said, they don't want to stop the application and the delete has to work and they asked for different solution. Here i am not sure, what solution i need to provide them.
Can you please suggest me a approach and Thanks in advance.Hari wrote:
and at the same time the delete session is also waiting for exclusive lock on those table. The only way the delete session could be waiting for an exclusive lock on the table is if the code to delete from the customer includes the command: lock table customer in exclusive mode;Unless your original description is wrong, either the deletion code has to change or the application has to stop modifying the customer table.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
Author: <b><em>Oracle Core</em></b> -
Master Dataload is taking long time to complete
Hi
In last couple of weeks, we are experience the delay for master dataload job. These dataload should take 5-8 minute to complete but it is taking more then 5 hour to complete. here we are using process chain for master dataload.
Any idea? We don't understand where to start to check the root cause of this problem.
Regards
AmarHi Freinds
Some update of our master dataload. Still not resolved.
Seem to me, our problem is related to Hierarchy in BW server.It is taking long time to update the hierarchy in BW server. As i told you, problem occur only when loading master dataload. For transaction dataload, no IDOC get stuck in R/3 (NPR) server. There are enough resources in both R/3 and BW server for trfc.
There are total 9 hierarchy in the master dataload that is delaying in the process for update. If you have seen this type of problem for the following hierarchy, pls update me.
A 0ACCOUNT (InfoSource)
Hierarchy
1 Fin statement vers FSV5
2 Cost Element by fun area
B 0COSTCENTER (InfoSource)
Hierarchy
3 Mitel Network
4 NA MNS Total
5 CEO
6 Global Support Cost center
C 0COORDER (infosource)
Hierarchy
7 Total R&D (Ron Wellard)
8 RD YRD1
9 RD YRD2
Regards
Amarjit -
Simple query is taking long time
Hi Experts,
The below query is taking long time.
[code]SELECT FS.*
FROM ORL.FAX_STAGE FS
INNER JOIN
ORL.FAX_SOURCE FSRC
INNER JOIN
GLOBAL_BU_MAPPING GBM
ON GBM.BU_ID = FSRC.BUID
ON UPPER (FSRC.FAX_NUMBER) = UPPER (FS.DESTINATION)
WHERE FSRC.IS_DELETED = 'N'
AND GBM.BU_ID IS NOT NULL
AND UPPER (FS.FAX_STATUS) ='COMPLETED';[/code]
this query is returning 1645457 records.
[code]PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 625K| 341M| 45113 (1)|
| 1 | HASH JOIN | | 625K| 341M| 45113 (1)|
| 2 | NESTED LOOPS | | 611 | 14664 | 22 (0)|
| 3 | TABLE ACCESS FULL| FAX_SOURCE | 2290 | 48090 | 22 (0)|
| 4 | INDEX RANGE SCAN | GLOBAL_BU_MAPPING_BUID | 1 | 3 | 0 (0)|
| 5 | TABLE ACCESS FULL | FAX_STAGE | 2324K| 1214M| 45076 (1)|
PLAN_TABLE_OUTPUT
Note
- 'PLAN_TABLE' is old version
15 rows selected.[/code]
The distinct number of records in each table.
[code]SELECT FAX_STATUS,count(*)
FROM fax_STAGE
GROUP BY FAX_STATUS;
FAX_STATUS COUNT(*)
BROKEN 10
Broken - New 9
Completed 2324493
New 20
SELECT is_deleted,COUNT(*)
FROM FAX_SOURCE
GROUP BY IS_DELETED;
IS_DELETED COUNT(*)
N 2290
Y 78[/code]
Total number of records in each table.
[code]SELECT COUNT(*) FROM ORL.FAX_SOURCE FSRC-- 2368
SELECT COUNT(*) FROM ORL.FAX_STAGE--2324532
SELECT COUNT(*) FROM APPS_GLOBAL.GLOBAL_BU_MAPPING--9
[/code]
To improve the performance of this query I have created the following indexes.
[code]Functional based index on UPPER (FSRC.FAX_NUMBER) ,UPPER (FS.DESTINATION) and UPPER (FS.FAX_STATUS).
Bitmap index on FSRC.IS_DELETED.
Normal Index on GBM.BU_ID and FSRC.BUID.
[/code]
But still the performance is bad for this query.
What can I do apart from this to improve the performance of this query.
Please help me .
Thanks in advance.<I have created the following indexes.
CREATE INDEX ORL.IDX_DESTINATION_RAM ON ORL.FAX_STAGE(UPPER("DESTINATION"))
CREATE INDEX ORL.IDX_FAX_STATUS_RAM ON ORL.FAX_STAGE(LOWER("FAX_STATUS"))
CREATE INDEX ORL.IDX_UPPER_FAX_STATUS_RAM ON ORL.FAX_STAGE(UPPER("FAX_STATUS"))
CREATE INDEX ORL.IDX_BUID_RAM ON ORL.FAX_SOURCE(BUID)
CREATE INDEX ORL.IDX_FAX_NUMBER_RAM ON ORL.FAX_SOURCE(UPPER("FAX_NUMBER"))
CREATE BITMAP INDEX ORL.IDX_IS_DELETED_RAM ON ORL.FAX_SOURCE(IS_DELETED)
After creating the following indexes performance got improved.
But our DBA said that new BITMAP index at FAX_SOURCE table (ORL.IDX_IS_DELETED_RAM) can cause locks
on multiple rows if IS_DELETED column is in use. Please proceed with detailed tests.
I am sending the explain plan before creating indexes and after indexes has been created.
SELECT FS.*
FROM ORL.FAX_STAGE FS
INNER JOIN
ORL.FAX_SOURCE FSRC
INNER JOIN
GLOBAL_BU_MAPPING GBM
ON GBM.BU_ID = FSRC.BUID
ON UPPER (FSRC.FAX_NUMBER) = UPPER (FS.DESTINATION)
WHERE FSRC.IS_DELETED = 'N'
AND GBM.BU_ID IS NOT NULL
AND UPPER (FS.FAX_STATUS) =:B1;
--OLD without indexes
PLAN_TABLE_OUTPUT
Plan hash value: 3076973749
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 141K| 85M| 45130 (1)| 00:09:02 |
|* 1 | HASH JOIN | | 141K| 85M| 45130 (1)| 00:09:02 |
| 2 | NESTED LOOPS | | 611 | 18330 | 22 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| FAX_SOURCE | 2290 | 59540 | 22 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | GLOBAL_BU_MAPPING_BUID | 1 | 4 | 0 (0)| 00:00:01 |
|* 5 | TABLE ACCESS FULL | FAX_STAGE | 23245 | 13M| 45106 (1)| 00:09:02 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
1 - access(UPPER("FSRC"."FAX_NUMBER")=UPPER("FS"."DESTINATION"))
3 - filter("FSRC"."IS_DELETED"='N')
4 - access("GBM"."BU_ID"="FSRC"."BUID")
filter("GBM"."BU_ID" IS NOT NULL)
5 - filter(UPPER("FS"."FAX_STATUS")=SYS_OP_C2C(:B1))
21 rows selected.
--NEW with indexes.
PLAN_TABLE_OUTPUT
Plan hash value: 665032407
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5995 | 3986K| 3117 (1)| 00:00:38 |
|* 1 | HASH JOIN | | 5995 | 3986K| 3117 (1)| 00:00:38 |
| 2 | NESTED LOOPS | | 611 | 47658 | 20 (5)| 00:00:01 |
|* 3 | VIEW | index$_join$_002 | 2290 | 165K| 20 (5)| 00:00:01 |
|* 4 | HASH JOIN | | | | | |
|* 5 | HASH JOIN | | | | | |
PLAN_TABLE_OUTPUT
| 6 | BITMAP CONVERSION TO ROWIDS| | 2290 | 165K| 1 (0)| 00:00:01 |
|* 7 | BITMAP INDEX SINGLE VALUE | IDX_IS_DELETED_RAM | | | | |
| 8 | INDEX FAST FULL SCAN | IDX_BUID_RAM | 2290 | 165K| 8 (0)| 00:00:01 |
| 9 | INDEX FAST FULL SCAN | IDX_FAX_NUMBER_RAM | 2290 | 165K| 14 (0)| 00:00:01 |
|* 10 | INDEX RANGE SCAN | GLOBAL_BU_MAPPING_BUID | 1 | 4 | 0 (0)| 00:00:01 |
| 11 | TABLE ACCESS BY INDEX ROWID | FAX_STAGE | 23245 | 13M| 3096 (1)| 00:00:38 |
|* 12 | INDEX RANGE SCAN | IDX_UPPER_FAX_STATUS_RAM | 9298 | | 2434 (1)| 00:00:30 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
1 - access(UPPER("DESTINATION")="FSRC"."SYS_NC00035$")
3 - filter("FSRC"."IS_DELETED"='N')
4 - access(ROWID=ROWID)
5 - access(ROWID=ROWID)
7 - access("FSRC"."IS_DELETED"='N')
10 - access("GBM"."BU_ID"="FSRC"."BUID")
filter("GBM"."BU_ID" IS NOT NULL)
12 - access(UPPER("FAX_STATUS")=SYS_OP_C2C(:B1))
31 rows selected
Please confirm on the DBA comment.Is this bitmap index locks rows in my case.
Thanks.> -
Hi
Is there any provision or api in MAC to open a file in shared mode same as windows
hUSBdrive = CreateFile(pDriveName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
we have the follwing scenario where a file is shared among two processes for read/write.one is running on Linux and the other one is running on MAC.where both the processses are reading/writing into the same memory location in the file say "X"
FAT 32 formatted raw data file which is located on the device, is shared among two processes.
One process is running on Linux device which is connected to MAC book through usb.In this linux process, the file is opened using fopen() and we have used fcntl() with O_DIRECT flag.This process continuously reads/writes data on memory location "X" in the shared file .
The other process is running on Mac which has simple c program that opens the file on the connected device i.e from usb drive and reads/writes data using fread()/fwrite().fopen() is used to open the file and FILE_NOCACHE flag is used to avoid caching.
The value at memory location "X" is updated by mac by using fwrite() and the linux process reads the memory location "X" by using fread(). Linux process is taking around 30 sec to get the updated value.
If the value is updated by Linux process at memory location "X" by using fwrite() the MAC process is also taking long time more than a minute to read the updated value by usng fread().
fwrite()/fread() on mac is taking long time where as the windows application which uses the same apis is taking msec time.
Do we need to use other api s or flags to open file?
thanks in advance.......does any one face this kind of problem?
fwrite() and fread() takes long time?
Is there any problem in read/write to a fat32 file on MAC? -
Sales order creation, standard event trigger is taking long time .
We have a requirement where we are sending data to CRM system using RFC function module. This data is sent while sales order creation or change. We have used standard event BUS2032.CREATED to trigger CRM FM in sales order creation mode. In sales order change mode, we are using custom event. In production system, our custom change event is getting triggered fine and data is sent to CRM system with small time lag of around 1 minute. But, while sales order creation, standard event trigger is taking long time ( sometimes about 20 minutes) in production system.
We tried triggering same custom event at the time of sales order creation using FM u2018SWE_EVENT_CREATE_IN_UPD_TASKu2019 as well but, still we are not able to improve performance of the event trigger at sales order creation.
Regards,
Sushee JoshiHI,
we have written SWE_EVENT_CREATE in update task
I think instead of calling in update task simply call to function module CALL FUNCTION "SWE_EVENT_CREATE" might trigger the event immediately.. Did you try to check in this way..
OR
And I also suggest you to check the entry in SWE2 txn with respect to your workflow tempalte, may be you have enable the option ENABLE EVENT QUEUE, this could be one of the reasons.. If it is enabled please disable it (uncheck)
Please check..
Regards
Pavan -
VB Macro in Bex Analyser is taking long time to complete execution
Hi Experts,
In a FI query , we have a VB macro which update the excel sheets by taking values from the previous excel sheets .
The issue is its taking long time for query execution and if we are keep on pressing 'ENTER' button . The query is running very fastly and is giving the results ,but its not a correct way to do.
Its a critical issue in Production and can anyone help me to resolve the issue.
Regards,
AnjuHi Anju,
I need to create a VB macro in one of my query but i not familiar how i can plug the VB code into the query.
Please can you give me some basic procedure on how to do that?
What i need to do exactly is to bring a KF from a query into another query. Not sure if this is possible using VB.
Let me know.
Thanks.
Cesar -
------Load Dataset into Temp table---------------
SELECT
z.SYSTEMNAME
--,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name]
--else NULL
--End AS SubSystemName
, CASE
WHEN z.PROV_TAX_ID IN
(SELECT DISTINCT zxc.TIN
FROM dbo.SQS_Provider_Tracking zxc
WHERE zxc.[SubSystem Name] <> 'NULL'
THEN
(SELECT DISTINCT [Subsystem Name]
FROM dbo.SQS_Provider_Tracking zxc
WHERE z.PROV_TAX_ID = zxc.TIN)
End As SubSYSTEMNAME
,z.PROVIDERNAME
,z.STATECODE
,z.PROV_TAX_ID
,z.SRC_PAR_CD
,SUM(z.SEQUEST_AMT) Actual_Sequestered_Amt
, CASE
WHEN z.SRC_PAR_CD IN ('E','O','S','W')
THEN 'Nonpar Waiver'
--**Amendment Mailed**
--WHEN z.PROV_TAX_ID IN
When EXISTS
(SELECT DISTINCT b.PROV_TIN
FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
where not exists (select * from dbo.sqs_objector_TINs t where b.PROV_TIN = t.prov_tin))
THEN
(SELECT DISTINCT b.Mailing
FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
WHERE z.PROV_TAX_ID = b.PROV_TIN
-- --**Amendment Mailed Wave 3 and 4**
--WHEN z.PROV_TAX_ID In
When EXISTS
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz WITH (NOLOCK )
where qz.Mailing = 'Amendment Mailed (3rd Wave)'
and not exists (select * from dbo.sqs_objector_TINs t WITH (NOLOCK ) where qz.PROV_TIN = t.prov_tin))
THEN 'Amendment Mailed (3rd Wave)'
WHEN EXISTS
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz WITH (NOLOCK )
where qz.Mailing = 'Amendment Mailed (4th Wave)'
and not exists (select * from dbo.sqs_objector_TINs t WITH (NOLOCK ) where qz.PROV_TIN = t.prov_tin))
THEN 'Amendment Mailed (4th Wave)'
-- --Is Puerto Rico of Lifesynch
WHEN EXISTS
(SELECT DISTINCT a.PROV_TAX_ID
FROM PACT.dbo.SQS_NonPar_PR_LS_TINs a WITH (NOLOCK )
WHERE a.Bucket <> 'Nonpar'
THEN
(SELECT DISTINCT a.Bucket
FROM PACT.dbo.SQS_NonPar_PR_LS_TINs a WITH (NOLOCK )
WHERE a.PROV_TAX_ID = z.PROV_TAX_ID)
-- --**Top Objecting Systems**
WHEN z.SYSTEMNAME IN
('ADVENTIST HEALTH SYSTEM','ASCENSION HEALTH ALLIANCE','AULTMAN HEALTH FOUNDATION','BANNER HEALTH SYSTEM','BERT FISH MEDICAL CENTER','BETHESDA MEMORIAL HOSPITAL','BJC HEALTHCARE','BLOUNT MEMORIAL HOSPITAL','BOCA RATON REGIONAL HOSPITAL','CAROMONT HEALTH SYSTEM','CATHOLIC HEALTH INITIATIVES','CATHOLIC HEALTHCARE PARTNERS','CHRISTUS HEALTH',/*'CLEVELAND CLINIC HEALTH SYSTEM',*/'COLUMBUS REGIONAL HEALTHCARE SYSTEM','COMMUNITY HEALTH SYSTEMS, INC','COXHEALTH','HCA','HEALTH MANAGEMENT ASSOCIATES','HUNTSVILLE HOSPITAL HEALTH SYSTEM','INTEGRIS HEALTH','JUPITER MEDICAL CENTER','LEE MEMORIAL HEALTH SYSTEM','MARTIN MEMORIAL HEALTH SYSTEM','MERCY','MT SINAI MEDICAL CENTER (MIAMI)','MUNROE REGIONAL MEDICAL CENTER','NORMAN REGIONAL HEALTH SYSTEM','NORTHSIDE HEALTH SYSTEM','SHANDS HEALTHCARE','SISTERS OF MERCY - SPRINGFIELD, MO','SSM HEALTH CARE','ST LUKES HEALTH SYSTEM','SUMMA HEALTH SYSTEM','SUSQUEHANNA HEALTH SYSTEM','TBD -- TRINITY HEALTH - CATHOLIC HEALTH EAST','UNIVERSITY OF MISSOURI HEALTH SYSTEM','UNIVERSITY OF NEW MEXICO HOSPITALS','UNIVERSITY OF UTAH HEALTH CARE')
THEN 'Top Objecting Systems'
WHEN EXISTS
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Top Objector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
THEN 'Top Objecting Systems'
-- --**Other Objecting Hospitals**
WHEN EXISTS
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Objector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
THEN 'Other Objecting Hospitals'
-- --**Objecting Physicians**
WHEN EXISTS
(SELECT z.PROV_TAX_ID
FROM SQS_EDW_Source z WITH (NOLOCK)
WHERE EXISTS
(SELECT DISTINCT
obj.TIN
FROM SQS_Provider_Tracking obj WITH (NOLOCK )
WHERE obj.[Objector?] in ('Objector','Top Objector')
and z.PROV_TAX_ID = obj.TIN
and z.LCLM_RSTMT_TREND_CAT_CD not IN ('HO','HI')
THEN 'Objecting Physicians'
--****Rejecting Hospitals****
WHEN EXISTS
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Rejector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
THEN 'Rejecting Hospitals'
--****Rejecting Physciains****
WHEN EXISTS
(SELECT obj.TIN
FROM SQS_Provider_Tracking obj WITH (NOLOCK )
WHERE z.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Rejector')
and z.LCLM_RSTMT_TREND_CAT_CD NOT IN ('HO','HI')
THEN 'REjecting Physicians'
----**********ALL OBJECTORS SHOULD HAVE BEEN BUCKETED AT THIS POINT IN THE QUERY**********
-- --**Non-Objecting Hospitals**
WHEN EXISTS
(SELECT DISTINCT
h.PROV_TAX_ID
FROM
#HIHO_Records h WITH (NOLOCK )
WHERE
(z.PROV_TAX_ID = h.PROV_TAX_ID)
OR h.SMG_ID IS NOT NULL
)and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
THEN 'Non-Objecting Hospitals'
-- **Outstanding Contracts for Review**
WHEN EXISTS
(SELECT qz.PROV_TIN
FROM
[PACT].[HUMAD\ARS3766].[SQS_Mailed_TINs] qz WITH (NOLOCK )
where qz.Mailing = 'Non-Objecting Bilateral Physicians'
AND z.PROV_TAX_ID = qz.PROV_TIN)
Then 'Non-Objecting Bilateral Physicians'
When EXISTS
(select
p.prov_tax_id
from dbo.SQS_CoC_Potential_Mail_List p WITH (NOLOCK )
where p.amendmentrights <> 'Unilateral'
AND z.prov_tax_id = p.prov_tax_id)
THEN 'Non-Objecting Bilateral Physicians'
WHEN EXISTS
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz WITH (NOLOCK )
where qz.Mailing = 'More Research Needed'
AND qz.PROV_TIN = z.PROV_TAX_ID)
THEN 'More Research Needed'
WHEN EXISTS (SELECT qz.PROV_TIN FROM [SQS_Mailed_TINs] qz WITH (NOLOCK ) where qz.Mailing = 'Objector' AND qz.PROV_TIN = z.PROV_TAX_ID)
THEN 'ERROR'
else 'Market Review/Preparing to Mail'
END AS [Updated Bucket]
,COALESCE(q.INDdesc, f.IND_desc) AS INDdesc
,f.Time_Period_for_Dispute
,f.Renew_Term_Ind
,f.Renewal_Date
,z.SMG_ID
,'' AS OrderedRank
INTO SQS_Bucketed_Details_SMG_on_SMGXXX
From #SQS_EDW_SOURCE_WithSMG z
left join #F f ON f.PROV_TAX_ID = z.PROV_TAX_ID
AND z.SYSTEMNAME = f.SYSTEM_NAME
AND z.PROVIDERNAME = f.Provider
Left join #Q q ON z.PROV_TAX_ID = q.TIN
GROUP BY z.SYSTEMNAME
--,Z.[SubsystemName]
,z.PROVIDERNAME
,z.STATECODE
,z.PROV_TAX_ID
,z.SRC_PAR_CD
,q.INDdesc
,f.IND_Desc
,f.Time_Period_for_Dispute
,f.Renew_Term_Ind
,f.Renewal_Date
,z.SMG_ID
,z.LCLM_RSTMT_TREND_CAT_CD
As I am a developer I do not have the access to Sql profiler or tuning agent to optimize my query, I have used some joins over the temp table #HIHO which indeed pulling the records from table EDW_Source which has 5 million records, I also added Non clustered
indexes on prov_ID, SMG_ID and Incurred month for this table, but still it is taking longer time. Need helpHi, It needs some more tweaks but pls try this one
USE
Go
--****Create sqs_objector_TINs (Objections and Rejections)****
--Drop table .dbo.sqs_objector_TINs
select distinct a.TIN as Prov_TIN
Into #sqs_objector_TINs
from .dbo.sqs_provider_tracking as a with (nolock)
where a.[Objector?] in ('Top Objector','Objector','Rejector')
/*********** Query for SQS_TINtoSyst***********/
--DROP TABLE .dbo.SQS_TINtoSystem
select distinct
b.SRC_PROV_ID
--,case
-- when a.SYSTEM_NAME is null
-- then
-- case
-- when a.CTRCT_GRP_NAME is null
-- then a.PROV_SMG_NAME
-- else a.CTRCT_GRP_NAME
-- end
-- else a.SYSTEM_NAME
--end as SYSTEM_NAME
,COALESCE(a.SYSTEM_NAME, a.CTRCT_GRP_NAME, a.PROV_SMG_NAME) AS SYSTEM_NAME
INTO #SQS_TINtoSystem
from
PARE.dbo.EDW_PROD_HOSPITAL_MASTER a with (nolock)
Inner Join PARE.dbo.EDW_PROD_HOSPITAL_ID_XREF b with (nolock)
on a.SMG_ID = b.SMG_ID
-- Inner Join .dbo.SQS_EDW_Source q
--on b.SRC_PROV_ID = q.PROV_TAX_ID
where b.SRC_PLATFORM_CD = 'TX'
and exists
select
SMG_ID
from PARE.dbo.EDW_PROD_HOSPITAL_ID_XREF as t1 with (nolock)
where SRC_PLATFORM_CD = 'TX'
and exists (select q.PROV_TAX_ID from .dbo.SQS_EDW_Source q with (nolock) where q.PROV_TAX_ID = b.SRC_PROV_ID)
and a.SMG_ID = t1.SMG_ID
/************** Query for SQS_Bucketed_Details_SMG*****************/
DROP TABLE .dbo.SQS_Bucketed_Details_SMG
--Create temp table
SELECT z.SYSTEMNAME
,Z.PROV_TAX_ID
,z.PROVIDERNAME
,z.STATECODE
,z.SRC_PAR_CD
,z.SEQUEST_AMT
,case when Z.LCLM_RSTMT_TREND_CAT_CD IN ('HI','HO') Then 'H' else 'P' end as Hosp_Ind
,Z.SMG_ID
INTO #SQS_EDW_SOURCE_WithSMG
FROM dbo.SQS_EDW_SOURCE_WithSMG z with (nolock)
WHERE (Z.Incurred_Mth >= convert(datetime,'01/01/2013')) and (Z.Incurred_Mth < convert(datetime, '1/1/2014'))
--between convert(datetime,'01/01/2013') and convert(datetime, '12/31/2013 23:59:59.996')
--YEAR(Z.Incurred_Mth)=2013
-- Create Temp table Q
select
x.TIN,
case when max(x.IND) = 'NYN'
then 'Standard'
when max(x.IND) = 'YNN'
then 'Express'
when max(x.IND) = 'NNY'
then 'Non_Standard' else 'Mixed'
end as INDdesc
Into #Q
FROM
(SELECT
a.tin,
MAX(a.express) + MAX(a.StandardInd) + MAX(NonstandardIND) as IND
from
(select r.TIN,
case when MAX(r.Express) like 'Y%' then 'Y' else 'N' end As Express,
case when MAX(r.Standard) = 'Y' then 'Y' else 'N' end As StandardInd,
case when MAX(r.[Non-Standard]) = 'Y' then 'Y' else 'N' end AS NonstandardIND
FROM DBO.SQS_Objectors_01032014 r with (nolock)
GROUP BY r.TIN) a
group by a.TIN) x
group by x.TIN
--Create Temp table F
Select *
INTO #F
FROM(
SELECT distinct g.prov_tax_id
,g.system_name
,g.provider
,case when g.reimburse_mixed = 'Y' then 'Mixed'
when g.reimburse_express = 'Y' then 'Express'
when g.reimburse_standard = 'Y' then 'Standard'
when g.reimburse_NonStandard = 'Y' then 'NonStandard'
end as IND_Desc
,g.Time_Period_for_Dispute
,case when g.Renewal_Date = 'N' and g.Expiration_Date = 'N'
then 'Unclear'
when g.Renewal_Date = 'N' and g.Expiration_Date <> 'N'
then 'Termination'
when g.Renewal_Date <> 'N' and g.Expiration_Date = 'N'
then 'Evergreen'
when g.Renewal_Date <> 'N' and g.Expiration_Date <> 'N'
then 'Termination'
else 'Unknown'
end as 'Renew_Term_Ind'
,g.Renewal_Date
FROM
(select distinct
bb.PROV_TAX_ID1 as prov_tax_id
,aa.*
from
[dbo].[Top_600_Hospitals3] aa with (nolock)
left join pare.dbo.EDW_PROD_HOSPITAL_MASTER bb with (nolock)
on --a.CTRCT_GRP_NAME = b.CTRCT_GRP_NAME
aa.Provider = bb.PROV_SMG_NAME
-- and (a.SYSTEM_NAME = b.SMG_SYS_NAME or a.SYSTEM_NAME = b.SYSTEM_NAME)
--and a.ADDR_LINE1 = b.ADDR_LINE1
and aa.STATE_CD = bb.STATE_CD
--and a.ZIP_CD = b.ZIP_CD
and aa.City1 = bb.CITY_NAME
where aa.SYSTEM_NAME <> 'SEE ABOVE') g
where g.system_name <> 'SEE ABOVE') h
where h.ind_Desc is not null
SELECT DISTINCT z.PROV_TAX_ID
, z.SMG_ID
INTO #HIHO_Records
FROM SQS_EDW_SOURCE_WithSMG z with (nolock)
WHERE z.LCLM_RSTMT_TREND_CAT_CD IN ('HO', 'HI')
AND Z.Incurred_Mth >=convert(datetime, '1/1/2013') and Z.Incurred_Mth <convert(datetime, '1/1/2014')
--YEAR(Z.Incurred_Mth)=2013
---------------------------------Load Dataset into Temp table---------------
SELECT
z.SYSTEMNAME
--,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name]
--else NULL
--End AS SubSystemName
, CASE
WHEN z.PROV_TAX_ID IN
(SELECT zxc.TIN
FROM dbo.SQS_Provider_Tracking zxc with (nolock)
WHERE zxc.[SubSystem Name] <> 'NULL'
THEN
(SELECT top 1 [Subsystem Name]
FROM dbo.SQS_Provider_Tracking zxc with (nolock)
WHERE z.PROV_TAX_ID = zxc.TIN)
End As SubSYSTEMNAME
,z.PROVIDERNAME
,z.STATECODE
,z.PROV_TAX_ID
,z.SRC_PAR_CD
,SUM(z.SEQUEST_AMT) Actual_Sequestered_Amt
, CASE
WHEN z.SRC_PAR_CD IN ('E','O','S','W')
THEN 'Nonpar Waiver'
-- --Is Puerto Rico of Lifesynch
WHEN z.PROV_TAX_ID IN
(SELECT a.PROV_TAX_ID
FROM .dbo.SQS_NonPar_PR_LS_TINs a with (nolock)
WHERE a.Bucket <> 'Nonpar'
THEN
(SELECT top 1 a.Bucket
FROM .dbo.SQS_NonPar_PR_LS_TINs a with (nolock)
WHERE a.PROV_TAX_ID = z.PROV_TAX_ID)
--**Amendment Mailed**
WHEN z.PROV_TAX_ID IN
(SELECT b.PROV_TIN
FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
where not exists (select * from dbo.sqs_objector_TINs t with (nolock) where b.PROV_TIN = t.prov_tin))
and z.Hosp_Ind = 'P'
THEN
(SELECT top 1 b.Mailing
FROM dbo.SQS_Mailed_TINs_010614 b with (nolock)
WHERE z.PROV_TAX_ID = b.PROV_TIN
-- --**Amendment Mailed Wave 3-5**
WHEN z.PROV_TAX_ID In
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz
where qz.Mailing = 'Amendment Mailed (3rd Wave)'
and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
and z.Hosp_Ind = 'P'
THEN 'Amendment Mailed (3rd Wave)'
WHEN z.PROV_TAX_ID IN
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz
where qz.Mailing = 'Amendment Mailed (4th Wave)'
and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
and z.Hosp_Ind = 'P'
THEN 'Amendment Mailed (4th Wave)'
WHEN z.PROV_TAX_ID IN
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz
where qz.Mailing = 'Amendment Mailed (5th Wave)'
and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
and z.Hosp_Ind = 'P'
THEN 'Amendment Mailed (5th Wave)'
-- --**Top Objecting Systems**
WHEN z.SYSTEMNAME IN
('ADVENTIST HEALTH SYSTEM','ASCENSION HEALTH ALLIANCE','AULTMAN HEALTH FOUNDATION')
THEN 'Top Objecting Systems'
WHEN z.PROV_TAX_ID IN
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Top Objector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.Hosp_Ind = 'H'
THEN 'Top Objecting Systems'
-- --**Other Objecting Hospitals**
WHEN (z.PROV_TAX_ID IN
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Objector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.Hosp_Ind = 'H')
THEN 'Other Objecting Hospitals'
-- --**Objecting Physicians**
WHEN (z.PROV_TAX_ID IN
(SELECT
obj.TIN
FROM .dbo.SQS_Provider_Tracking obj with (nolock)
WHERE obj.[Objector?] in ('Objector','Top Objector')
and z.PROV_TAX_ID = obj.TIN
and z.Hosp_Ind = 'P')
THEN 'Objecting Physicians'
--****Rejecting Hospitals****
WHEN (z.PROV_TAX_ID IN
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Rejector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.Hosp_Ind = 'H')
THEN 'Rejecting Hospitals'
--****Rejecting Physciains****
WHEN
(z.PROV_TAX_ID IN
(SELECT
obj.TIN
FROM .dbo.SQS_Provider_Tracking obj with (nolock)
WHERE z.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Rejector')
and z.Hosp_Ind = 'P')
THEN 'REjecting Physicians'
----**********ALL OBJECTORS SHOULD HAVE BEEN BUCKETED AT THIS POINT IN THE QUERY**********
-- --**Non-Objecting Hospitals**
WHEN z.PROV_TAX_ID IN
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
WHERE
(z.PROV_TAX_ID = h.PROV_TAX_ID)
OR h.SMG_ID IS NOT NULL)
and z.Hosp_Ind = 'H'
THEN 'Non-Objecting Hospitals'
-- **Outstanding Contracts for Review**
WHEN z.PROV_TAX_ID IN
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz with (nolock)
where qz.Mailing = 'Non-Objecting Bilateral Physicians'
AND z.PROV_TAX_ID = qz.PROV_TIN)
Then 'Non-Objecting Bilateral Physicians'
When z.prov_tax_id in
(select
p.prov_tax_id
from dbo.SQS_CoC_Potential_Mail_List p with (nolock)
where p.amendmentrights <> 'Unilateral'
AND z.prov_tax_id = p.prov_tax_id)
THEN 'Non-Objecting Bilateral Physicians'
WHEN z.PROV_TAX_ID IN
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz
where qz.Mailing = 'More Research Needed'
AND qz.PROV_TIN = z.PROV_TAX_ID)
THEN 'More Research Needed'
WHEN z.PROV_TAX_ID IN (SELECT qz.PROV_TIN FROM [SQS_Mailed_TINs] qz with (nolock) where qz.Mailing = 'Objector' AND qz.PROV_TIN = z.PROV_TAX_ID)
THEN 'ERROR'
else 'Market Review/Preparing to Mail'
END AS [Updated Bucket]
,COALESCE(q.INDdesc, f.IND_desc) AS INDdesc
,f.Time_Period_for_Dispute
,f.Renew_Term_Ind
,f.Renewal_Date
,z.SMG_ID
,'' AS OrderedRank
INTO dbo.SQS_Bucketed_Details_SMG with (nolock)
From #SQS_EDW_SOURCE_WithSMG z
left join #F f ON f.PROV_TAX_ID = z.PROV_TAX_ID
AND z.SYSTEMNAME = f.SYSTEM_NAME
AND z.PROVIDERNAME = f.Provider
Left join #Q q ON z.PROV_TAX_ID = q.TIN
GROUP BY z.SYSTEMNAME
--,Z.[SubsystemName]
,z.PROVIDERNAME
,z.STATECODE
,z.PROV_TAX_ID
,z.SRC_PAR_CD
,q.INDdesc
,f.IND_Desc
,f.Time_Period_for_Dispute
,f.Renew_Term_Ind
,f.Renewal_Date
,z.SMG_ID
,z.Hosp_Ind
/************************** Drop temp tables*********************/
--DROP TABLE #SQS_EDW_SOURCE_WithSMG
--DROP TABLE #Q
--DROP TABLE #F
--DROP TABLE #HIHO_Records
--DROP TABLE #SQS_TINtoSystem
--DROP TABLE #SQS_EDW_SOURCE_WithSMG
--DROP TABLE #sqs_objector_TINs -
my time capsule is taking too much time indexing backup and then taking longer time to back up ( 207 days ) or longer !!! what shall i do ?
Try 10.7.5 supplemental update.
This update seems to have solved this problem for many.
Best.
Maybe you are looking for
-
How to create a calendar using Xcode 4.5
I am new to xcode and trying to create a calendar in one of the tabs in a tab based application. I dont know what needs to be added in the view area, but from my searching net I have come to know that using eventkit.h one can create a calender. So I
-
AVCHD 5.1 to Stereo Sound Issue on Panasonic SD1
When I log and Transfer in FCP 6.0.1 The video turns out fine, but the Audio the right channel is WAY louder then the left channel after conversion. Other conversion programs do not seem to have this issue. Can anyone help? I am very stuck Also shoul
-
Do I have to use airport extreme to be a main network if I want to use Airport express extend my wifi range.
-
Can we Open Period at one time for all entity
Hi Environment: 11.5.10 Is it possible to open period for all the legal entities at single click like R12. Any alternative?
-
Dear All, I have created a sales office and the description maintained is in English. I want the description to be in Chinese as well. Hence when I go to Go To -> Translations , I was not able to find the Chinese language key there. Can anyone please