Vision Global TicketSalesScript: Difference between revisions

From Prodigix Wiki
Jump to navigation Jump to search
(Script to review then run for Vision Global Ticket sales import)
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
------------------------------------------------------------------------------<br/>
<nowiki>------------------------------------------------------------------------------</nowiki>


--     check to verify the ticket import completed succesfully, change date to the day you run the import<br/>
--     check to verify the ticket import completed succesfully, change date to the day you run the import


------------------------------------------------------------------------------<br/>
<nowiki>------------------------------------------------------------------------------</nowiki>


(      SELECT EventCode <br/>
(      SELECT EventCode


       FROM TicketEventCodes <br/>
       FROM TicketEventCodes


       WHERE CAST(CreatedDate AS DATE) = '10/17/2022' <br/>
       WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date)


)
)


------------------------------------------------------------------------------ <br/>
<nowiki>------------------------------------------------------------------------------</nowiki>  


--     Change date to date of most recent ticket import <br/>
--     Change date to date of most recent ticket import


------------------------------------------------------------------------------ <br/>
<nowiki>------------------------------------------------------------------------------</nowiki>


--     check to verify no records returned in following query. If so, do not run anything below <br/>
--     check to verify no records returned in following query. If so, do not run anything below  


------------------------------------------------------------------------------ <br/>
<nowiki>------------------------------------------------------------------------------</nowiki>  


SELECT * <br/>
SELECT *  


FROM TicketSales <br/>
FROM TicketSales  


WHERE distid >= 2147483647 <br/>
WHERE distid >= 2147483647  


AND EventCode IN <br/>
AND EventCode IN  


( <br/>
(  


       SELECT EventCode <br/>
       SELECT EventCode


       FROM TicketEventCodes <br/>
       FROM TicketEventCodes  


       WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date) <br/>
       WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date)  


) <br/>
)  


------------------------------------------------------------------------------ <br/>
<nowiki>------------------------------------------------------------------------------</nowiki>  


--     Run top query and copy sponsor ids into second query <br/>
--     Run top query and copy sponsor ids into second query


------------------------------------------------------------------------------ <br/>
<nowiki>------------------------------------------------------------------------------</nowiki>  


--     Update distIDs in first query to have sponsor of current sponsor. Usually returns 3 distIDs. <br/>
--     Update distIDs in first query to have sponsor of current sponsor. Usually returns 3 distIDs.  


--     aka update sponsor of distIDs in first query to their sponsor's sponsor  <br/>
--     aka update sponsor of distIDs in first query to their sponsor's sponsor


------------------------------------------------------------------------------ <br/>
<nowiki>------------------------------------------------------------------------------</nowiki>  


select * <br/>
select *


from DistributorDetail <br/>
from DistributorDetail


where sponsorid >= 2147483647 <br/>
where sponsorid >= 2147483647  


and distid < 2147483647 <br/>
and distid < 2147483647


<br/>


select DistID, SponsorID, * <br/>
select DistID, SponsorID, *  


from distributordetail <br/>
from distributordetail  


where distid in () <br/>
where distid in ()  


<br/>


update DistributorDetail <br/>
update DistributorDetail  


set SponsorID = , UplineDID = <br/>
set SponsorID = , UplineDID =  


where distid =  <br/>
where distid =   


------------------------------------------------------------------------------ <br/>
<nowiki>------------------------------------------------------------------------------</nowiki>  


--     Run queries and change "select *" to "Delete" and run <br/>
--     Run queries and change "select *" to "Delete" and run  


------------------------------------------------------------------------------ <br/>
<nowiki>------------------------------------------------------------------------------</nowiki>


select * <br/>
select *  


from Payment <br/>
from Payment  


where orderid in <br/>
where orderid in  


(       select OrderID <br/>
(       select OrderID  


       from orders <br/>
       from orders  


       where distid >= 2147483647 <br/>
       where distid >= 2147483647


)
)


select * <br/>
select *  


from orderlines <br/>
from orderlines


where orderid in <br/>
where orderid in


(
(


       select OrderID <br/>
       select OrderID  


       from orders <br/>
       from orders


       where distid >= 2147483647 <br/>
       where distid >= 2147483647  


)
)


select * <br/>
select *  


from orders <br/>
from orders  


where distid >= 2147483647 <br/>
where distid >= 2147483647  


select * <br/>
select *  


from DistributorDetail <br/>
from DistributorDetail  


where distid >= 2147483647 <br/>
where distid >= 2147483647  


select * <br/>
select *  


from Distributor <br/>
from Distributor  


where distid >= 2147483647
where distid >= 2147483647

Latest revision as of 20:23, 3 November 2023

------------------------------------------------------------------------------

--     check to verify the ticket import completed succesfully, change date to the day you run the import

------------------------------------------------------------------------------

(      SELECT EventCode

       FROM TicketEventCodes

       WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date)

)

------------------------------------------------------------------------------

--     Change date to date of most recent ticket import

------------------------------------------------------------------------------

--     check to verify no records returned in following query. If so, do not run anything below

------------------------------------------------------------------------------

SELECT *

FROM TicketSales

WHERE distid >= 2147483647

AND EventCode IN

(

       SELECT EventCode

       FROM TicketEventCodes

       WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date)

)

------------------------------------------------------------------------------

--     Run top query and copy sponsor ids into second query

------------------------------------------------------------------------------

--     Update distIDs in first query to have sponsor of current sponsor. Usually returns 3 distIDs.

--     aka update sponsor of distIDs in first query to their sponsor's sponsor

------------------------------------------------------------------------------

select *

from DistributorDetail

where sponsorid >= 2147483647

and distid < 2147483647


select DistID, SponsorID, *

from distributordetail

where distid in ()


update DistributorDetail

set SponsorID = , UplineDID =

where distid = 

------------------------------------------------------------------------------

--     Run queries and change "select *" to "Delete" and run

------------------------------------------------------------------------------

select *

from Payment

where orderid in

(       select OrderID

       from orders

       where distid >= 2147483647

)

select *

from orderlines

where orderid in

(

       select OrderID

       from orders

       where distid >= 2147483647

)

select *

from orders

where distid >= 2147483647

select *

from DistributorDetail

where distid >= 2147483647

select *

from Distributor

where distid >= 2147483647