Solved

Warning: Null value is eliminated by an aggregate or other SET operation.

Posted on 2010-08-31
6
446 Views
Last Modified: 2012-05-10
Ok, I have been trying to figure this out, it keeps breaking but this is all it gives me, If i run each individual filter by itself they work just fine, and this process works fine for a couple days and then breaks itself.  How can I trouble shoot to find out where the exact error is coming from while runnning this thing SP.
 Can I put a print somewhere in here that might lead me to the problem for this darn thing.

First what it does is slect all the filters (SQL code) that are assigned to people, then it goes through and runs the code on every persone to see if they have problems, per the sql code, if they do then it saves it to a table.

Here is an example of the sql code.
Select p.intPositionId  , p.strPara  , p.strline  , 'SRP Dental'  , mt.dtMODRE_Date  , pp.strName  , pp.strSSN   from tblUnitPosition as p     Inner join tblUnitPersonnel as pp          on p.intPositionId = pp.intPositionId     INNER JOIN ModreTracker.dbo.tblResults as mt          on mt.strSSN = pp.strssn   where mt.bitDental = 1   And intUnitMobId =
declare @counter int, 
		@countfilter int, 
		@FilterID int, 
		@AssignedID int, 
		@UnitID int, 
		@DeployDate datetime,
		@TaskName varchar(60), 
		@Proponent varchar(60),
		@ApproveLev varchar(15),
		@Days int, 
		@Sql nvarchar(4000), 
		@PositionId int, 
		@Para varchar(4), 
		@Line varchar(3), 
		@Posn varchar(60), 
		@Sid varchar(60), 
		@Name varchar(60), 
		@SSN varchar(10), 
		@cur cursor, 
		@taskID int 
 
Declare Vend_Cursor CURSOR FOR Select uf.intFilterId, uf.intAssignedID, uf.intUnitMobId, ud.dtdeployDate,
										f.strTaskname, f.strProponent, f.strApprovalLevel, f.strSusDays, f.strSql 
										from tblSoldierFilters as uf Inner join tblUnitDeployData as ud on 
										ud.intUnitMobId = uf.intUnitMobId Inner Join tblFilter as f on 
										f.intFilterID = uf.intFilterId where uf.dtRemoved is NULL 
										order by uf.intfilterID

OPEN Vend_Cursor

FETCH NEXT FROM Vend_Cursor INTO @FilterID,@AssignedId,@UnitId,@DeployDate,@Taskname,@Proponent,@ApproveLev,@Days,@Sql
 
while @@FETCH_STATUS =0 
begin
	--- Call the SQL Filter and assign the unit # as the variable to get at table	
	
	set @Sql = N'set @cur = cursor for ' + @Sql + Cast(@UnitID as varchar) + ';open @cur'

	exec sp_executesql @Sql, N'@cur cursor OUTPUT', @cur output

	fetch next from @cur into @PositionId, @Para, @Line, @Posn, @Sid, @Name, @SSN
	
	while @@FETCH_STATUS =0 
	begin
		set @taskID = (select intTaskId from tblTask where intFilterId = @FilterID and intPositionId = @PositionId)
		
		if (select isnull(@taskID, 0)) = 0
		begin
			Insert Into tblTask (intAssignedId, intFilterId, intPositionID, strTaskName, dtFound, strStatus, 
						dtStatus, strSSN, strName, strPositionData, strSoldierData, strProponent, dtNotification,
						dtCompleteTask) 
			VALUES (@AssignedId, @FilterID, @PositionId, @Taskname, Getdate(), @ApproveLev, Getdate(),@SSN, 
					@Name, @Posn, @Sid, @Proponent, Getdate(), dateadd(DAY, -@Days, @DeployDate)) 
		end
		
		fetch next from @cur into @PositionId, @Para, @Line, @Posn, @Sid, @Name, @SSN
	end
	
	close @cur
	deallocate @cur	
	  
	FETCH NEXT FROM Vend_Cursor INTO @FilterID,@AssignedId,@UnitId,@DeployDate,@Taskname,@Proponent,@ApproveLev,@Days,@Sql
end

Close vend_Cursor
deallocate vend_Cursor

Open in new window

0
Comment
Question by:kdeutsch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 33570677
If that's the *only* error you're getting, issue this statement inside the stored proc / start of T-SQL code:

SET ANSI_WARNINGS OFF

But that's just a warning, it shouldn't keep the code from finishing.
0
 

Author Comment

by:kdeutsch
ID: 33570715
ScottPletcher:
Ok trying now it takes this things about 20 min to run.  Is there a way to put some print statments in this thing to see where its failing or at what part its failing.
0
 

Author Comment

by:kdeutsch
ID: 33570729
ScottPletcher:
I ran into this error, I have some sql queries that go over a linked server to get results, don't know if that would cause this.

Msg 7405, Level 16, State 1, Line 1
Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 33589807
You can't -- and don't want -- to try to get around that.

Instead, you'll have to modify the SQL code that contains the grouping function.  That'll be a pain because I don't see it in your code, so it must be in the @sql / cursor def code.
0
 

Author Comment

by:kdeutsch
ID: 33590211
ScottPletcher:

Found the problem was a bit of sql code that runs insdie the whole process was picking to much information instead of the standard 7 items that the stored procedure allow.
0
 

Author Closing Comment

by:kdeutsch
ID: 33620474
This is really not solution but because picking mine and divding out points seems to be a pain and I want to colse out the question.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

631 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