declare @tableName nvarchar(64)
declare @num int
declare @i int
set @i=0
select @num=count(*) from sysobjects where type='u'
while @i<@num
begin
select @tableName=name from sysobjects where type='u'
print @tableName
set @i=@i+1
end貌似不行,请教高手。
declare @num int
declare @i int
set @i=0
select @num=count(*) from sysobjects where type='u'
while @i<@num
begin
select @tableName=name from sysobjects where type='u'
print @tableName
set @i=@i+1
end貌似不行,请教高手。
declare @num int
declare @i int
set @i=0
select @num=count(*) from sysobjects where type='u'
while @i<@num
begin
select @tableName=name from sysobjects where type='u' --这里得到的是最后一个表名,
print @tableName
set @i=@i+1
end--要实现的话,用游标
declare @B char(10)
DECLARE vend_cursor CURSOR FOR
select name from sysobjects where type='u'OPEN vend_cursor FETCH NEXT
FROM vend_cursor into @BWHILE @@FETCH_STATUS =0BEGIN
print @BFETCH NEXT
FROM vend_cursor into @B
END
CLOSE vend_cursor
DEALLOCATE vend_cursor
declare @num int
declare @i int
set @i=0
select @num=count(*) from sysobjects where type='u'
while @i<@num
begin
select name from (
select name,row_number() over(order by name) as n from sysobjects where type='u'
)T where n=@i
print @tableName
set @i=@i+1
end