declare @i int
set @i=3
exec('select top ' + @i + ' * from table')
print ('select top ' + cast(@i as varchar(10)) + ' * from table')
set @i=3
exec('select top ' + @i + ' * from table')
print ('select top ' + cast(@i as varchar(10)) + ' * from table')
set @i=3
exec('select top ' + cast(@i as varchar(20)) + ' * from table')
print('select top ' + cast(@i as varchar(20)) + ' * from table')