Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Decimal datatype & database mail

Author  Topic 

riya.johnson
Starting Member

17 Posts

Posted - 2010-06-07 : 02:54:08
Hi,

I am running this below query on query analyser

create table #list (backup_size decimal (5,4),database_name nvarchar(20),backup_start_date datetime)
go
insert #list select cast(backup_size/1024/1024/1024 as decimal(5,4)) "backup_size",database_name,backup_start_date from msdb..backupset where backup_start_date between getdate()-1 and getdate()
go
select database_name "DB Name ", count(1) as 'File Count ', sum(backup_size) " Size" from #list where database_name in ('DEPDB','HRMS40','SCMDB') group by database_name
go
drop table #list
go


The on the results pane, i get the following result

DB Name File Count Size
-------------------- ----------- ---------------------------------------
DEPDB 94 0.1291
HRMS40 94 1.2363



But when i put the same query into database mail, its not showing the right decimal figure in the output as below.

DB Name File Count Size
-------------------- ----------- ----------------------------------------
DEPDB 94 1291
HRMS40 94 1.2363

Riya Johnson

naveengopinathasari
Yak Posting Veteran

60 Posts

Posted - 2010-06-07 : 03:33:41
Convert the Last Column to VARCHAR and check.

Lets unLearn
Go to Top of Page
   

- Advertisement -