Home Page link  

trigger to update last sold date in HQ item table

 

Point-Of-Sale Software - - MS Point Of Sale software discussed here 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content  add this group's latest topics to your Google content  YahooMyWeb Yahoo!  Google Google  Windows Live Favorites Windows Live  del.icio.us del.icio.us  digg digg  Add to Netscape Netscape
Subject Author Date
trigger to update last sold date in HQ item table Sad 01-28-2009
Posted by Sad on January 28, 2009, 10:26 am
Please log in for more thread options
hi ,
i need to update automaticaly the last sold date in HQ from last sold date
in store (since it is not updated from stores).
can we use item dynamic table to update item table ? if so can any one give
a trigger to do that.
thanks

Posted by Joie on January 28, 2009, 10:36 am
Please log in for more thread options
I have no idea about HQ

However, in my opinion creating trigger can slow down database executions.
Be careful with that

May be it would be better if you create a stored procedure to contain the
update logic and then schedule the stored procedure to run hourly or daily
?

rgds,
Joie


> hi ,
> i need to update automaticaly the last sold date in HQ from last sold date
> in store (since it is not updated from stores).
> can we use item dynamic table to update item table ? if so can any one
> give
> a trigger to do that.
> thanks



Posted by Sad on January 28, 2009, 10:50 am
Please log in for more thread options
thank you joie
i am a biggener in sql, can you help me with that please.

"Joie" wrote:

> I have no idea about HQ
>
> However, in my opinion creating trigger can slow down database executions.
> Be careful with that
>
> May be it would be better if you create a stored procedure to contain the
> update logic and then schedule the stored procedure to run hourly or daily
> ?
>
> rgds,
> Joie
>
>
> > hi ,
> > i need to update automaticaly the last sold date in HQ from last sold date
> > in store (since it is not updated from stores).
> > can we use item dynamic table to update item table ? if so can any one
> > give
> > a trigger to do that.
> > thanks
>
>
>

Posted by convoluted on January 28, 2009, 2:02 pm
Please log in for more thread options
Hi Sad - my first suggestion would be to (if its in the budget) work with a
RMS-certified partner that can help you build and maintain SQL queries....as
SQL is nice to use but it can be tricky to manage. Joie makes a good point
regarding triggers, as they can affect the performance of your database.
Here's one possible option you can look into (without recurring to a trigger)

The problem with the itemdynamic table is that it tracks several "last sold"
dates, one for each store, so you have to "pick" the most recent "last sold"
date.

I would first create a view that summarizes for you the "last sold" date for
all stores, then join that view to your item table on an update query that
you would run as a batch file via the windows scheduler program.

Here is the syntax for the view:

create view item_last_sold
as
select id.itemid, i.itemlookupcode, MAX(id.lastsold) as last_sold
from itemdynamic id
inner join item i on id.itemid = i.id
group by id.itemid, i.itemlookupcode

Test the successful creation of the view by running
select * from item_last_sold

Here is the update query you can save on a notepad, save it as a .bat file,
then schedule the .bat file to run after your stores poll with HQ, using the
windows scheduler:

update item
set item.lastsold = item_last_sold.last_sold
from item
inner join item_last_sold on item.id = item_last_sold.itemid

If you can, test these on a testing database first, and remember to backup
your database prior to running the queries.

But, really, this is something that Mickeysoft MUST fix on the next version
of RMS...hope this helps.

"Sad" wrote:

> thank you joie
> i am a biggener in sql, can you help me with that please.
>
> "Joie" wrote:
>
> > I have no idea about HQ
> >
> > However, in my opinion creating trigger can slow down database executions.
> > Be careful with that
> >
> > May be it would be better if you create a stored procedure to contain the
> > update logic and then schedule the stored procedure to run hourly or daily
> > ?
> >
> > rgds,
> > Joie
> >
> >
> > > hi ,
> > > i need to update automaticaly the last sold date in HQ from last sold date
> > > in store (since it is not updated from stores).
> > > can we use item dynamic table to update item table ? if so can any one
> > > give
> > > a trigger to do that.
> > > thanks
> >
> >
> >

Posted by Sad on January 29, 2009, 1:56 am
Please log in for more thread options
thank you all, that was helpfull.

"convoluted" wrote:

> Hi Sad - my first suggestion would be to (if its in the budget) work with a
> RMS-certified partner that can help you build and maintain SQL queries....as
> SQL is nice to use but it can be tricky to manage. Joie makes a good point
> regarding triggers, as they can affect the performance of your database.
> Here's one possible option you can look into (without recurring to a trigger)
>
> The problem with the itemdynamic table is that it tracks several "last sold"
> dates, one for each store, so you have to "pick" the most recent "last sold"
> date.
>
> I would first create a view that summarizes for you the "last sold" date for
> all stores, then join that view to your item table on an update query that
> you would run as a batch file via the windows scheduler program.
>
> Here is the syntax for the view:
>
> create view item_last_sold
> as
> select id.itemid, i.itemlookupcode, MAX(id.lastsold) as last_sold
> from itemdynamic id
> inner join item i on id.itemid = i.id
> group by id.itemid, i.itemlookupcode
>
> Test the successful creation of the view by running
> select * from item_last_sold
>
> Here is the update query you can save on a notepad, save it as a .bat file,
> then schedule the .bat file to run after your stores poll with HQ, using the
> windows scheduler:
>
> update item
> set item.lastsold = item_last_sold.last_sold
> from item
> inner join item_last_sold on item.id = item_last_sold.itemid
>
> If you can, test these on a testing database first, and remember to backup
> your database prior to running the queries.
>
> But, really, this is something that Mickeysoft MUST fix on the next version
> of RMS...hope this helps.
>
> "Sad" wrote:
>
> > thank you joie
> > i am a biggener in sql, can you help me with that please.
> >
> > "Joie" wrote:
> >
> > > I have no idea about HQ
> > >
> > > However, in my opinion creating trigger can slow down database executions.
> > > Be careful with that
> > >
> > > May be it would be better if you create a stored procedure to contain the
> > > update logic and then schedule the stored procedure to run hourly or daily
> > > ?
> > >
> > > rgds,
> > > Joie
> > >
> > >
> > > > hi ,
> > > > i need to update automaticaly the last sold date in HQ from last sold
date
> > > > in store (since it is not updated from stores).
> > > > can we use item dynamic table to update item table ? if so can any one
> > > > give
> > > > a trigger to do that.
> > > > thanks
> > >
> > >
> > >

Similar ThreadsPosted
Items with last received date greater than last sold date March 21, 2006, 9:23 pm
SQL trigger on offline inventory table? June 23, 2005, 2:51 pm
Update Price1A Trigger June 13, 2005, 7:21 am
Rob...Cost update trigger October 20, 2006, 12:03 pm
Trigger to update price a,b,c September 28, 2008, 5:06 pm
Trigger Update Current Record Only November 20, 2005, 6:14 pm
Date sold filter value July 21, 2007, 9:41 pm
SQL Statement to Update ReorderPoint based on QTY Sold During time October 15, 2007, 10:28 pm
Items sold based on date and supplier February 14, 2007, 12:36 pm
Use of Subform to update Table April 20, 2006, 1:04 am

Contact Us | Privacy Policy
This site is not affiliated with Intuit - makers of Quickbooks and Quicken software
This site is not affiliated with Sage Software - makers of Peachtree accounting software
XML SitemapXML Sitemap