Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 ref cursor in t-sql

Author  Topic 

zahid.sabreen
Starting Member

14 Posts

Posted - 2011-01-20 : 02:27:28
Hi ALL,


CREATE OR REPLACE PROCEDURE BASE1."GET_CP_JDBC_ORACLE" (
cp_code in VARCHAR2, cp_cursor out SYS_REFCURSOR
)

------------------------------------------------------------------------
CAN ANYONE PLEASE assist me how to write a similar ref cursor in t-sql using sql server 2000

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2011-01-20 : 03:36:28
In SQLServer you don't need to output any reference cursor

CREATE OR REPLACE PROCEDURE BASE1."GET_CP_JDBC_SQL"
([b]@/[b]cp_code in VARCHAR2)
go
select * from mytble where mycol = @cp_code
end

In SQL EXEC GET_CP_JDBC_SQL(cp_code=15)
In VB/Other assign the SP to a New RecordSet object. the (recordset) output from the SP will be assigned to the VB/Other object.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-01-20 : 10:12:49
CREATE PROCEDURE GET_CP_JDBC_SQL
(
@cp_code VARCHAR(100)
)
as
select * from mytble where mycol = @cp_code

GO

EXEC GET_CP_JDBC_SQL @cp_code=15

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -