January 9, 2013 at 2:24 am
Hi all,
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.
January 9, 2013 at 2:29 am
The error is occurring in the stored procedure itself. Do you get the same error if you run just the EXEC line?
John
January 9, 2013 at 2:44 am
John Mitchell-245523 (1/9/2013)
The error is occurring in the stored procedure itself. Do you get the same error if you run just the EXEC line?John
No, it is not giving me the error it is actually giving me the result of sp_spaceused
January 9, 2013 at 3:23 am
The your first statement should start IF NOT EXISTS, should it not? In any case, please post the results of the following query:
SELECT * FROM tempdb.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME LIKE '#temp%'
John
January 9, 2013 at 3:45 am
John Mitchell-245523 (1/9/2013)
The your first statement should start IF NOT EXISTS, should it not? In any case, please post the results of the following query:
SELECT * FROM tempdb.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME LIKE '#temp%'
John
Ooppss.....My Apologies.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply