Vision Global TicketSalesScript: Difference between revisions
(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: | ||
------------------------------------------------------------------------------< | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
-- check to verify the ticket import completed succesfully, change date to the day you run the import | -- check to verify the ticket import completed succesfully, change date to the day you run the import | ||
------------------------------------------------------------------------------< | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
( SELECT EventCode | ( SELECT EventCode | ||
FROM TicketEventCodes | FROM TicketEventCodes | ||
WHERE CAST(CreatedDate AS DATE) = | WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date) | ||
) | ) | ||
------------------------------------------------------------------------------ < | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
-- Change date to date of most recent ticket import | -- Change date to date of most recent ticket import | ||
------------------------------------------------------------------------------ < | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
-- check to verify no records returned in following query. If so, do not run anything below | -- check to verify no records returned in following query. If so, do not run anything below | ||
------------------------------------------------------------------------------ < | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
SELECT * | SELECT * | ||
FROM TicketSales | FROM TicketSales | ||
WHERE distid >= 2147483647 | WHERE distid >= 2147483647 | ||
AND EventCode IN | AND EventCode IN | ||
( | ( | ||
SELECT EventCode | SELECT EventCode | ||
FROM TicketEventCodes | FROM TicketEventCodes | ||
WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date) | WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date) | ||
) | ) | ||
------------------------------------------------------------------------------ < | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
-- Run top query and copy sponsor ids into second query | -- Run top query and copy sponsor ids into second query | ||
------------------------------------------------------------------------------ < | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
-- Update distIDs in first query to have sponsor of current sponsor. Usually returns 3 distIDs. | -- 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 | -- aka update sponsor of distIDs in first query to their sponsor's sponsor | ||
------------------------------------------------------------------------------ < | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
select * | select * | ||
from DistributorDetail | from DistributorDetail | ||
where sponsorid >= 2147483647 | where sponsorid >= 2147483647 | ||
and distid < 2147483647 | and distid < 2147483647 | ||
select DistID, SponsorID, * | select DistID, SponsorID, * | ||
from distributordetail | from distributordetail | ||
where distid in () | where distid in () | ||
update DistributorDetail | update DistributorDetail | ||
set SponsorID = , UplineDID = | set SponsorID = , UplineDID = | ||
where distid = | where distid = | ||
------------------------------------------------------------------------------ < | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
-- Run queries and change "select *" to "Delete" and run | -- Run queries and change "select *" to "Delete" and run | ||
------------------------------------------------------------------------------ < | <nowiki>------------------------------------------------------------------------------</nowiki> | ||
select * | select * | ||
from Payment | from Payment | ||
where orderid in | where orderid in | ||
( select OrderID | ( select OrderID | ||
from orders | from orders | ||
where distid >= 2147483647 | where distid >= 2147483647 | ||
) | ) | ||
select * | select * | ||
from orderlines | from orderlines | ||
where orderid in | where orderid in | ||
( | ( | ||
select OrderID | select OrderID | ||
from orders | from orders | ||
where distid >= 2147483647 | where distid >= 2147483647 | ||
) | ) | ||
select * | select * | ||
from orders | from orders | ||
where distid >= 2147483647 | where distid >= 2147483647 | ||
select * | select * | ||
from DistributorDetail | from DistributorDetail | ||
where distid >= 2147483647 | where distid >= 2147483647 | ||
select * | select * | ||
from Distributor | 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