Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a column with datatype decimal(3,0) null
Column has values like 80, 90, 100
To this decimal value column, I need to append an % sign.
I need to cast the decimal value to nvarchar.
Expected output is 80%, 90%, 100%
SELECT CAST(YourColumn AS VARCHAR(3)) + '%'
FROM YourTable
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a decimal hour (logged_hours) column and its value in my table. I want to calculate this decimal hour value into minutes in SQL Server 2012.
logged_hours
------------
08.0000
09.0000
12.0000
You can multiply by 60:
select logged_hours * 60 as logged_minutes
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Ex: if we concatenate 12345 and 31-dec-2019 If we concatenate using & symbol we get 1234531-dec-19 in Ms access but if we do same in excel we get 1234543830 so to get the result as we get in excel what is the query to get this.
You can use the CLng function to convert the date field to a number:
SELECT NumberField, DateField,
[NumberField] & CLng([DateField]) AS CombinedData
FROM Table4;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Where is the problem with my sql command?
select REPLACE(CONVERT(varchar, CAST(price AS money), 1),'.','.') as price
output :
price
-----
145,000,00
I want output like this
price
-----
145.000,00
Formatting results is usually best left for the front end.
Having said that, with SQL Server 2016, use the format function with an appropriate locale:
declare #m money = 145000
select format (#m, '#,###.00', 'DE-de')
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a column in which i have 'goswara no. 21/1980' i need only 21 and year from date column like this col gr=21/year(date) through sql2005 query
http://sqlfiddle.com/#!6/bf991/6
something like this?
select
right(columnname,4) as year ,
SUBSTRING ( columnname ,len(columnname) - 6 ,2 ) as result
from test
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
How to select needed values without negative Total values according to this query?
Second row should not be returned as the Total value is less than 0.
SELECT DealerCode, PaymentType, Total
FROM DEL_Purchases
WHERE DealerCode = 'A0686P'
select DealerCode, PaymentType, Total from DEL_Purchases
where DealerCode='A0686P' and Total > 0