Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

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
0
NetDeveloper
Asked:
NetDeveloper
  • 2
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
You can run the same code in Query analyser, it will give you the results
0
 
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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