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 2000 Forums
 SQL Server Development (2000)
 SQL Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-13 : 08:45:23
Nagaratna writes "Can variables of type varchar can be used while declaring a cursor?

For Ex:

the usual way of declaring a cursor is,

Declare MyCursor Cursor FOR Select * from Employees

Instead of this,

Declare @Sql as varchar(1000)
SET @Sql= Select * from Employees

Declare MyCursor Cursor FOR @Sql

This is returning me an arror"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-13 : 09:00:41
It is possible using Dynamic SQL
But there should be better way than Cusrsor that you're trying to do
Post your exact requirement

Madhivanan

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

- Advertisement -