GEEK
GEEK

Reputation: 57

Adding string to a retrieved data in SQL Server

Can any one help me for this:

select round(sum(convert(float, size) / 1024 / 1024 / 1024), 2)

There is nothing wrong with the query. The thing here is, I need output as something like 1 GB like that. Is this possible to get the text 'GB' within the column itself.

Upvotes: 0

Views: 48

Answers (1)

Neil Hibbert
Neil Hibbert

Reputation: 862

SELECT CAST(round(sum(convert(float,size)/1024/1024/1024),2) AS VARCHAR(20)) + UPPER('gb') AS [Size]

should do the trick...

Upvotes: 2

Related Questions