I am trying to stored the output of sp_spaceused into a temp table as follow.
if exists (select 1 from sys.objects where object_id=OBJECT_ID(N'#TEMP'))
create table #temp (name nvarchar(50),rows nvarchar(50),reserved nvarchar(50),data nvarchar(50),index_size nvarchar(50),unused nvarchar(50))
insert into #temp
exec sp_spaceused 'dbo.Emp'
i am getting the error as below
Msg 8114, Level 16, State 1, Procedure sp_spaceused, Line 178
Error converting data type varchar to int.
Now if we observed closely in my temp table there isn't any column with datatype as int.So i am not able to figure it out, why is it trying to convert the column to int when it can stored it nvarchar.