New answers tagged

2 votes

How can functions that make heavy use of table variables be optimised?

Cheat: Remove the table variables, convert the function to an inline table-valued function, and hope for the best. Cheat: Convert the table variables to temp tables, convert the function to a stored ...
J.D.'s user avatar
  • 37.2k
1 vote

Query to return latest record between 2 tables

You can use with MySQL 8.x Window Functions And a word of advise save MySQL dates in iso norm format '2019-09-07' WITH CTE AS (select c.cusID ,ROW_NUMBER() OVER(PARTITION BY c.cusID ORDER BY c....
nbk's user avatar
  • 8,002
17 votes
Accepted

Are views logically redundant?

Both views and inline TVFs are updatable, and can be used interchangeably almost everywhere. Specifically for SQL Server, the following features are supported by views that are not available for ...
Charlieface's user avatar
  • 12.6k
7 votes

Are views logically redundant?

Background Concepts in mainstream SQL database engines have evolved gradually over decades to fulfil the most prominent needs at the time, and there have also been a number of industrial standards ...
Steve's user avatar
  • 319
2 votes
Accepted

Convert numbers to words | Spell out DECIMAL USD 1259.75 as 'One thousand two hundred fifty-nine dollars and seventy-five cents'

Modify the 100/1000/1000000 "WHEN" portions of the SELECT statement to be like this, and you should achieve your desired result. WHEN @Number BETWEEN 100 AND 999 THEN dbo.NumberToWords((...
Craig's user avatar
  • 136

Top 50 recent answers are included