TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kavita
NA
131
143.6k
pass cursor variable
Aug 3 2007 4:34 AM
hi this is kavita I am creating a procedure like:
alter proc insert_tmpsearch1now
@var4 varchar(50)
as
select @var4='select top 10 * from activetable'
DECLARE @var1 VARCHAR(50),@var2 VARCHAR(50),@var3 VARCHAR(200)
DECLARE CUR CURSOR FOR select top 10 * from activetable
OPEN CUR
FETCH NEXT FROM CUR INTO @var1,@var2,@var3
WHILE @@FETCH_STATUS = 0
BEGIN
print execute(@var4)
insert into tmpsearch1now(ssid,ref_no,sr_no,detail) values('4',@var1,@var2,@var3)
FETCH NEXT FROM CUR INTO @var1,@var2,@var3
END
CLOSE CUR
DEALLOCATE CUR
go
it work fine but I want to pass a variable say @var4 in declare cursor line like this
DECLARE CUR CURSOR FOR execute(@var4)
but it gave some error How can I do this?
please help!!!
Reply
Answers (
0
)
Dot Net on Mac OS ?
procedure parameter length