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
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 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 to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a table ACCOUNT(ACCOUNT_NUMBER,BRANCH_NAME,BALANCE)
Now I need to find in Oracle SQL : all accounts with balances over R.100000 receive 6 percent interest whereas all others receive 5 percent.
I need to display the balance with 6% and balance with 5% in two different column.
What is the SQL query for it?
Maybe this is what you want:
select
account_number,
case
when balance > 100000 then balance*1.06
end AS With6PercentInterest,
case
when balance <= 100000 then balance*1.05
end AS With5PercentInterest
from ACCOUNT;
Sample SQL Fiddle
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
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