Citrix Director issue related to MSSQL

Hi MS SQL and Citrix Experts

i have the issue in this URL

https://support.citrix.com/article/CTX208206

but the solution inside this URL dose not work with me

please check the attached file

how can i remove the  nul   0000000000000000000000000  in my case

kindly advice
ddddddd.jpg
LVL 1
sword12Asked:
Who is Participating?
 
John_VidmarConnect With a Mentor Commented:
The order in which Citrix presented the delete-statements is important, otherwise, you shall receive referential-integrity errors (i.e., the constraint messages you get in red-text).
I'll explain the following:
delete	MonitorData.Session
where	machineid in	(	Select Id
					from MonitorData.Machine
					where DesktopGroupID = @did
				)

Open in new window

The select-statement wrapped in parenthesis is called a subquery, which shall return zero, one, or many records.  A subquery participating in an in-clause may only contain a single field in the select.  Assume the subquery returns three records (11, 83, 492), this is then used in the delete where-clause to further restrict which records are deleted.  Behind the scenes, the following would be equivalent:
delete	MonitorData.Session
where	machineid in (11, 83, 492)

Open in new window

Don't alter the statements from Citrix, just ensure you are in the correct database by adding the use-database and go
use [CitrixLentingMonitoring]
go
declare @did uniqueidentifier 
set @did = '00000000-0000-0000-0000-000000000000' 
delete from MonitorData.Session where machineid in (Select Id from MonitorData.Machine where DesktopGroupID = @did) 
delete from MonitorData.ResourceUtilizationSummary where DesktopGroupId = @did 
delete from MonitorData.ResourceUtilization where DesktopGroupId = @did 
delete from MonitorData.ApplicationInstanceSummary where DesktopGroupId = @did 
delete from MonitorData.DesktopGroupApplications where DesktopGroupId = @did 
delete from MonitorData.SessionActivitySummary where DesktopGroupId = @did 
delete from MonitorData.FailureLogSummary where DesktopGroupId = @did 
delete from MonitorData.ServerOSDesktopSummary where DesktopGroupId = @did 
delete from MonitorData.DesktopOSDesktopSummary where DesktopGroupId = @did 
delete from MonitorData.Machine where DesktopGroupId = @did 
delete from MonitorData.DesktopGroup where id = @did

Open in new window

1
 
_agx_Commented:
The error message says it cannot delete the uuid from "DesktopGroup" because it's still being referenced by 1 or more records in "Machine" table.  Did you run all of the DELETE's - in order?  

Run a select on that uuid.  What result to you get?

declare @did uniqueidentifier
set @did = '00000000-0000-0000-0000-000000000000'
select * from MonitorData.Machine where DesktopGroupId = @did
select * from MonitorData.DesktopGroup where id = @did
0
 
sword12Author Commented:
thnaks for help

please check the attached file

and if you can give me the all commands that i have to issue one after one
dd2.jpg
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
sword12Author Commented:
can you give the solution one by one

i have no idea about data base administration

declare @did uniqueidentifier
set @did = '00000000-0000-0000-0000-000000000000'
delete from MonitorData.Session where machineid in (Select Id from MonitorData.Machine where DesktopGroupID = @did)
delete from MonitorData.ResourceUtilizationSummary where DesktopGroupId = @did
delete from MonitorData.ResourceUtilization where DesktopGroupId = @did
delete from MonitorData.ApplicationInstanceSummary where DesktopGroupId = @did
delete from MonitorData.DesktopGroupApplications where DesktopGroupId = @did
delete from MonitorData.SessionActivitySummary where DesktopGroupId = @did
delete from MonitorData.FailureLogSummary where DesktopGroupId = @did
delete from MonitorData.ServerOSDesktopSummary where DesktopGroupId = @did
delete from MonitorData.DesktopOSDesktopSummary where DesktopGroupId = @did
delete from MonitorData.Machine where DesktopGroupId = @did
delete from MonitorData.DesktopGroup where id = @did
0
 
John_VidmarCommented:
You were in the wrong database when you executed the above commands.  

Your attachment (dd2.jpg) showed the first select worked because it used 3-part qualification (database.owner.object) with the correct database, your second statement produced an error because you are in the wrong database.
1
 
sword12Author Commented:
U r right

But in this url

https://support.citrix.com/article/CTX208206

I have to work with monitoring data base

Desk group dB not machine dB

So what I have to do now
0
 
John_VidmarCommented:
Add use-database above the statements from Citrix (hopefully I spelled it correctly):
use [CitrixLentingmonitoring]
go
declare @did uniqueidentifier 
set @did = '00000000-0000-0000-0000-000000000000' 
delete from MonitorData.Session where machineid in (Select Id from MonitorData.Machine where DesktopGroupID = @did) 
delete from MonitorData.ResourceUtilizationSummary where DesktopGroupId = @did 
delete from MonitorData.ResourceUtilization where DesktopGroupId = @did 
delete from MonitorData.ApplicationInstanceSummary where DesktopGroupId = @did 
delete from MonitorData.DesktopGroupApplications where DesktopGroupId = @did 
delete from MonitorData.SessionActivitySummary where DesktopGroupId = @did 
delete from MonitorData.FailureLogSummary where DesktopGroupId = @did 
delete from MonitorData.ServerOSDesktopSummary where DesktopGroupId = @did 
delete from MonitorData.DesktopOSDesktopSummary where DesktopGroupId = @did 
delete from MonitorData.Machine where DesktopGroupId = @did 
delete from MonitorData.DesktopGroup where id = @did

Open in new window

1
 
_agx_Commented:
@sword12 - All of the tables in the script are in the same database.  You need to switch to that database first. John_Vidmar's answer shows how to do that with:  USE yourdatabaseNameHere
0
 
sword12Author Commented:
thnak you all for help but i am still stuck with this

delete from MonitorData.Session where machineid in (Select Id from MonitorData.Machine where DesktopGroupID = @did)

i don't understand what dose it mean (Select Id from MonitorData.Machine where DesktopGroupID = @did)

option one i isued this and i got error check the attached file
use [CitrixLentingmonitoring]
go
declare @did uniqueidentifier
set @did = '00000000-0000-0000-0000-000000000000'
delete from MonitorData.ResourceUtilizationSummary where DesktopGroupId = @did
delete from MonitorData.ResourceUtilization where DesktopGroupId = @did
delete from MonitorData.ApplicationInstanceSummary where DesktopGroupId = @did
delete from MonitorData.DesktopGroupApplications where DesktopGroupId = @did
delete from MonitorData.SessionActivitySummary where DesktopGroupId = @did
delete from MonitorData.FailureLogSummary where DesktopGroupId = @did
delete from MonitorData.ServerOSDesktopSummary where DesktopGroupId = @did
delete from MonitorData.DesktopOSDesktopSummary where DesktopGroupId = @did
delete from MonitorData.Machine where DesktopGroupId = @did
delete from MonitorData.DesktopGroup where id = @did


option two i issued this and still no result

use [CitrixLentingmonitoring]
go
declare @did uniqueidentifier
set @did = '00000000-0000-0000-0000-000000000000'
delete from MonitorData.Session where machineId = @did
delete from MonitorData.ResourceUtilizationSummary where DesktopGroupId = @did
delete from MonitorData.ResourceUtilization where DesktopGroupId = @did
delete from MonitorData.ApplicationInstanceSummary where DesktopGroupId = @did
delete from MonitorData.DesktopGroupApplications where DesktopGroupId = @did
delete from MonitorData.SessionActivitySummary where DesktopGroupId = @did
delete from MonitorData.FailureLogSummary where DesktopGroupId = @did
delete from MonitorData.ServerOSDesktopSummary where DesktopGroupId = @did
delete from MonitorData.DesktopOSDesktopSummary where DesktopGroupId = @did
delete from MonitorData.Machine where DesktopGroupId = @did
delete from MonitorData.DesktopGroup where id = @did


so how i can pass this issue please
dd3.jpg
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.