help with stored procedure

Hi, I created a stored procecure with this logic. I woul like to test it in sql analyzer and see the recordset that it should exract. What I have to do? Thanks and regards

------------------------------------------------------------------------------

BEGIN
      SET NOCOUNT ON

DECLARE @Cv_Guid uniqueidentifier

DECLARE Cv_Id_Cursor CURSOR FOR
SELECT  guid
FROM    dbo.MyTable1

-- declare the cursor
OPEN Cv_Id_Cursor
FETCH Cv_Id_Cursor INTO @Cv_Guid

WHILE @@Fetch_Status = 0        

BEGIN
  SELECT * FROM Mytable2 WHERE guid = @Cv_Guid
  and (dataType = '41' and (dataDate >= '2007-05-27' and dataDate < CONVERT(varchar,getdate()+1,112)))

   FETCH Cv_Id_Cursor INTO @Cv_Guid
 END

CLOSE Cv_Id_Cursor
DEALLOCATE Cv_Id_Cursor
END
LVL 10
NetDeveloperAsked:
Who is Participating?
 
Aneesh RetnakaranDatabase AdministratorCommented:
Also, i dont think you need a cursor here

SELECT t2.* FROM Mytable2 t2
inner join  MyTable1 t1 on  t1.guid = t2.Guid
WHERE (dataType = '41' and (dataDate >= '2007-05-27' and dataDate < CONVERT(varchar,getdate()+1,112)))
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
You can run the same code in Query analyser, it will give you the results
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.