Solved

I want to run the following querries against my SCCM database

Posted on 2015-02-18
4
305 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 48

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 48

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 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