sp_select
sp_select copied to clipboard
varchar(max) and nvarchar(max) are not supported
When using a varchar(max) or varchar(max) column a NULL value is returned
Repro script:
create table #longstrings (id int, name varchar(max))
insert into #longstrings values (1, cast(REPLICATE('X', 4000) as varchar(max)) + REPLICATE('Y', 4000))
exec sp_select 'tempdb..#longstrings'
-- returns NULL for the name column
select * from #longstrings
-- correctly returns the data.