cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
988
Views
4
Helpful
3
Replies

SQL to Update device's device pool inputting device name and device pool name

Adan Zuniga
Level 1
Level 1

All, 

I am proud to say I am getting better at Querying the SQL database. I am learning of table relationships and such. However, I have hit a roadblock, can you help?

I need an SQL statement that inputs a device name (SEPXXXXXXXXXXXX) and a device Pool XX_XX_DP and updates that device to that device pool. I know that the result of querying the device table for the field fkdevicepool gives a guid and I assume that my update statement has to update the fkdevicepool field to a guid. I hope that I do not have to do this in a 2 step approach where I first have to get the guid of the device pool and then do my update statement. That would suck. 

Thanks for the help.

P.S. 

Can the same logic be applied to updating a CSS and such? 

1 Accepted Solution

Accepted Solutions

Samuel Womack
Level 5
Level 5

You don't need to know the ID of the Device Pool you want to use to Update a Device..you can use the Device Pool Name..

update device set fkdevicepool=(select pkid from devicepool as dp where dp.name="DP_NAME") where device.name="#DEVICENAME"

SOAPUI is a good tool to use to experiment with these sort of calls..and if you don't have a lab..you could see if devnetsandbox.com will allow you to reserve an environment where you can play..

View solution in original post

3 Replies 3

I use Telisca CUCMQuery tool instead of creating sql query for each MAC address. Is device pool different for each device?

Thank you V. 

I am looking into your suggestion. 

Samuel Womack
Level 5
Level 5

You don't need to know the ID of the Device Pool you want to use to Update a Device..you can use the Device Pool Name..

update device set fkdevicepool=(select pkid from devicepool as dp where dp.name="DP_NAME") where device.name="#DEVICENAME"

SOAPUI is a good tool to use to experiment with these sort of calls..and if you don't have a lab..you could see if devnetsandbox.com will allow you to reserve an environment where you can play..