Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Convert Department data

1 view
Skip to first unread message

Peter Hall

unread,
Jul 19, 2010, 1:17:14 PM7/19/10
to
Hello - I have over 300 items that I would like moved from their current
Department, "English Radio", to a new department called "Music Audio". I'm
aware that I can do these changes manually, by selecting the item in HQ and
changing them one by one..But I'm hoping that perhaps there's an SQL query
that I can run to perform this task automatically.


Thanks,
Peter

ScottM

unread,
Jul 19, 2010, 4:23:13 PM7/19/10
to
Are you wanting to change all items from the current department to the new one?

If you want to change all items that have "English Radio" to "Music Audio,"
you could do this:

1.)Find the department IDs

select Name,ID from Department where name='English Radio'
select Name,ID from Department where name='Music Audio'

2.)Update the item

Update item
Set DepartmentID='ID From 'Music Audio'
Where DepartmentID='ID From 'English Radio'


If this works out right, it will update any item that has 'English Radio' to
'Music Audio.'
Again, if this is what you're looking for. Someone might have a better way...

Before running any SQL Statement like this, make sure to backup!

convoluted

unread,
Jul 19, 2010, 11:37:14 PM7/19/10
to
To add to Scott's posting, you could also first run SELECT queries to see the
items that will be updated - then, if the results look good, go ahead and run
the UPDATE query - and don't forget to backup the db first, "just in case".

Here's a sample SELECT query

SELECT itemlookupcode, description, price
from item
where departmentid = EnglishRadioDepartmentID

Hope this helps....

0 new messages