|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 11:24 AM
Points: 165,
Visits: 349
|
|
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.
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Tuesday, June 04, 2013 7:03 AM
Points: 4,443,
Visits: 7,249
|
|
The error is occurring in the stored procedure itself. Do you get the same error if you run just the EXEC line?
John
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 11:24 AM
Points: 165,
Visits: 349
|
|
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
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Tuesday, June 04, 2013 7:03 AM
Points: 4,443,
Visits: 7,249
|
|
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
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 11:24 AM
Points: 165,
Visits: 349
|
|
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.
|
|
|
|