|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 1:33 AM
Points: 738,
Visits: 1,126
|
|
While executing the below query to find the results getting the below error:
Do I need to use cast/convert statement?
Msg 8117, Level 16, State 1, Line 1 Operand data type nvarchar is invalid for sum operator.
select sum(database_name), backup_size/(1024*1024), backup_finish_date,type from backupset where type ='D' --order by backup_finish_date asc group by database_name
Thanks.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 4:49 AM
Points: 1,075,
Visits: 5,119
|
|
No. Cast/convert will not help here. You need to remove SUM() around database_name.
Evenafter that the query fails.
What are you trying to achieve? Other may help you to rewrite the query.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 2:05 AM
Points: 856,
Visits: 2,115
|
|
Hello,
database_name is a nvarchar, how can you pass it to SUM?
alter the query.
Regards Durai Nagarajan
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, February 20, 2013 2:26 PM
Points: 5,
Visits: 78
|
|
| Why do u want to sum database names????? sum is an aggregate function..how can it sum varchar column? what r u trying to achieve?
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, February 20, 2013 2:26 PM
Points: 5,
Visits: 78
|
|
| I think you are trying to find the combined backup size of all databases..is it?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 3:25 AM
Points: 1,371,
Visits: 2,302
|
|
| ... or trying for COUNT(database_name) ...huh ?
|
|
|
|