adspace
How to display a past time in days, hours and minutes?
Answer Posted / Vijayraj Singh Baghel
To display a past time in SQL Server in days, hours and minutes, you can use DATEDIFF function. Here's an example:n`DECLARE @pastDate DATETIME = '2022-01-01'; SELECT DATEDIFF(dd, @pastDate, GETDATE()) AS Days,n DATEDIFF(hh, @pastDate, GETDATE()) / 24.0 AS Hours,n DATEDIFF(mi, @pastDate, GETDATE()) / (60 * 24) AS Minutes;`
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain system functions or built-in functions? What are different types of system functions?
How to convert numeric expression data types using the cast() function?
If any stored procedure is encrypted, then can we see its definition in activity monitor?
This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?
What is sql or structured query language?
How do I find the sql server version?
What is in place upgrade in sql server?
Why we use the openxml clause?
Why and when do stored procedure recompile?
What is the primary use of the model database?
What are the properties of the transaction?
When should you use an instead of trigger?
What are the risks of storing a hibernate-managed object in a cache? How do you overcome the problems?
How can I check that whether automatic statistic update is enabled or not?
do you know how to configure db2 side of the application? : Sql server database administration