Solved

I want to run the following querries against my SCCM database

Posted on 2015-02-18
4
268 Views
Last Modified: 2016-10-13
I want to run the following querries against my SCCM database

SELECT * FROM ResPolicyMap WHERE machineid = 0 and PADBID IN (SELECT PADBID FROM PolicyAssignment WHERE BodyHash IS NULL)
 
 
This one will remove any bad policies if there are any.
 
Delete FROM ResPolicyMap WHERE machineid = 0 and PADBID IN (SELECT PADBID FROM PolicyAssignment WHERE BodyHash IS NULL)

i get the error

Msg 208, Level 16, State 1, Line 1
Invalid object name 'ResPolicyMap'.
0
Comment
Question by:Helao Mwapangasha
  • 2
4 Comments
 
LVL 46

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40616343
Check if you are running the query in the correct database context.
0
 
LVL 3

Author Comment

by:Helao Mwapangasha
ID: 40616387
will i do this in SQL or in SCCM admin Console under queries?
0
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40616399
I don't know SCCM. I was talking about SQL Server only. If you run for example in SQL Server Management Studio (SSMS) you need to pick up the database first in the query window or add the USE command before the query:
USE SCCM_DBNameHere
GO
Delete FROM ResPolicyMap 
WHERE machineid = 0 and PADBID IN (SELECT PADBID FROM PolicyAssignment WHERE BodyHash IS NULL)

Open in new window

0
 

Expert Comment

by:XCOP91 gmail
ID: 41842015
From SQL management studio, click new query, select database CM_sitename. then run your query.
It is highly recommended not to use any query which deletes or update SCCM database. The query which your are gonna run will delete all policy associations which might put you in trouble. So please run this if you are fully confident and aware. :)
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now