Convert Department data

Jul 19, 2010 2 Replies

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


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!

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

H> Are you wanting to change all items from the current department to the new one? >

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required