How to retrieve 10 distinct values of the last records?
For some manual analysis, I had to get the 10 last used codes, something like
How to dynamically create an audit table, preserving data types and create an Insert,Update,Delete Trigger
How would one dynamically create an audit table, preserving data types from the source table, and create an Insert,Update,Delete trigger for the audit table?
SQL Server – How to dynamically create an audit table, preserving data types and create an Insert,Update,Delete Trigger
How would one dynamically create an audit table, preserving data types from the source table, and create an Insert,Update,Delete trigger for the audit table?
Optimizing SQL Performance: Merging Budget and Actuals Tables After same CTE transformations and dimension joins
I have created a SQL query where I merge columns from a budget table and columns from a actuals table together using the same dimensions to join on customer, date and product. They need to undergo the same steps. If a product has been sold at least one time in that year by a customer than the yearmonth from 1 to 12 should be shown regardless if it has been sold or not in that particular yearmonth. This is the same for the budget.
What is the function on T-SQL that allows me to convert western characters to ocidental TEXT
What is the function on T-SQL that allows me to convert western characters to ocidental TEXT ?
It is not a translation, for example :
How to get difference from the first row but aggreagtiong from second row till the end
So, I have two columns where on first row (inspection) there are some violations that are spotted and noted … can be 15+ different violations. Then on every subsequent inspection there can be some violations that are completed (those that are resolved can NOT show again as unresolved). Number can vary and can even be that inspection didn’t see any of remaining violations resolved so for that one it would be an empty row but still has to be counted. What I need as a result are unresolved violations after each inspection …
Search for C1 control characters in SQL Server
I have a tables in SQL Server and some of the values in the varchar column contain C1 control characters https://en.wikipedia.org/wiki/C0_and_C1_control_codes#STX
Search for C1 control characters in SQL Server
I have a tables in SQL Server and some of the values in the varchar column contain C1 control characters https://en.wikipedia.org/wiki/C0_and_C1_control_codes#STX
LAG previous year wrong when grouped
I have created a SQL query which will show the current sales and sales from previous year with the LAG window function, this per customer, product, year and month. A product is not always sold each year and I know that LAG does not care about missing years, therefore the CASE statement, based on this stackoverflow post: LAG function alternative. I need the results for the missing year in between
SQL server – LAG previous year wrong when grouped
I have created a SQL query which will show the current sales and sales from previous year with the LAG window function, this per customer, product, year and month. A product is not always sold each year and I know that LAG does not care about missing years, therefore the CASE statement, based on this stackoverflow post: LAG function alternative. I need the results for the missing year in between