Hello,
I need to pass a [server_name] value dinamically to the=20
statement used in the definition of one cursor but...=20
don=B4t know how.
I need use server_name dinamically:
declare login_cur cursor for
select [name]
from [server_name].master.dbo.syslogins
Best regards
How about creating a stored procedure that looks like this? --
create procedure serversproc
@.sname char(20)
as
exec ('select * from ' + @.sname +'.master.dbo.sysdatabases')
go
exec serversproc MyServerName
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
Saturday, February 25, 2012
Pass a value dinamically into a cursor
Labels:
20donb4t,
cursor,
database,
definition,
dinamically,
microsoft,
mysql,
oracle,
server,
server_name,
sql,
the20statement,
value
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment