i want to place negative value in bracket like -2000 to (2000)
for that i made a which is converting -1361236.75886298 to (1.36124e+006)
the function that i made for this is :
ALTER function [dbo].[IsNegative](
@Number NVARCHAR (500)
)
Returns nvarchar (200)
as
begin
Declare @Number2 FLOAT
set @Number2=Cast (@Number as float)
Declare @result nvarchar (200)
if ( @Number2 <=0.0)
begin
Set @result='('+Substring (@Number,2,len(@Number))+')'
end
else
begin
Set @result = @Number
end
return @result
end
i want accurate answere
thanx in advance
What is the proposed usage of this function?
This type of formatting is probably best left to the presentation layer (assuming that there is a presentation layer)
The following function might be suitable for formatting individual standalone values that are to be concatenated into a longer string. It would probably not be suitable for formatting multiple values as you would want these all to aligned at the decimal point. For this you could investigate the
strfunction.Returns
Is that what you need?