[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

I want to run the following querries against my SCCM database

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
Helao Mwapangasha
Asked:
Helao Mwapangasha
  • 2
1 Solution
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Check if you are running the query in the correct database context.
0
 
Helao MwapangashaData Centre: Server EngineerAuthor Commented:
will i do this in SQL or in SCCM admin Console under queries?
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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
 
XCOP91 gmailCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now