stook (11/28/2014)
if the cursor is not working then try the insensitive cursor. Without cursor - you mean something like this?
declare @dbname nvarchar(255)='', @found bit=1
while @found=1 begin
set @found=0
select top 1 @dbname=name,@found=1 from master..sysdatabases where name>@dbname and name like '%tst%' order by name
if @found=1 begin
print @dbname
end
end
To be sure, that's just another form of a "cursor".
--Jeff Moden
Change is inevitable... Change for the better is not.