Skip to content
Advertisement

Tag: tsql

Retrieve the last valid value from a previous date

I have the following table “Rates”: aDate realRate isBusinessDay 01-04-22 1.10 1 02-04-22 1.20 1 03-04-22 1.30 1 04-04-22 1.40 0 05-04-22 1.50 0 06-04-22 1.60 1 07-04-22 1.70 1 08-04-22 1.80 1 09-04-22 1.90 1 10-04-22 2.00 0 11-04-22 2.10 0 12-04-22 2.20 0 13-04-22 2.30 0 14-04-22 2.40 1 15-04-22 2.50 1 16-04-22 2.60 1 17-04-22 2.70 1

how to get data grouped by ids

I have grouped data in a temporary table according to id_card. There are multiple activities for each card. I want to send 1 email for all activities happened on that particular card. But, I don’t know how to get data according to ids. should i use cursor for fetching the ids ? Example in the table, want 2 rows for

How can I avoid “stringly typed” code in T-SQL?

Consider some code like I believe that the technical term for such poor code is “stringly typed”. The key issue in the above code is that decisions are being made based on a string output that the developer needs to type and consistently get correct. If anything goes wrong, the language will be incapable of throwing errors. In a traditional

mssql execution order guarantee when conversion in where clause

I have following scalar function Problem with that is, that o.aValue could not only have numeric values, so that the convertion can fail, if it is executet on other rows of idmv_value_basic, where attrName is not ‘OM’. For some unknown reason this morning, our MSSQL-Server changed the execution order of the where conditions and the convertion failed. How could I

Advertisement