views:

106

answers:

1

I have a Visual Studio 2008 GDR Database Unit Test (Data Dude) with some TSQL that calls a sproc. I then have a single select statement that produces a 1-row result set with 2 columns. I want to pass the test if the values are equal and fail if it is not equal. I do not understand how to config/code this, can anyone point me in the right direction?

Thanks.

+1  A: 

Perhaps if you select the two columns into variables and compare those, rather than working with the result set directly? That's what we do - something like:

DECLARE @Name AS NVARCHAR (50), @Name2 AS NVARCHAR (50)

EXECUTE [dbo].[SomeStoredProcedure] @Name, @NAME2;

IF (@RC <> 1)
  RAISERROR('Source$Update test failed. @RC returned unexpected value.', 11, 1)

SELECT @Name = [Name],
       @Name2 = [Name2]
FROM [dbo].[Sometable]

IF (@Name <> @Name2)
  RAISERROR('SomeStoredProcedure test failed. @Name returned unexpected value.', 11, 1)
Peter LaComb Jr.