Skip to content
Advertisement

Tag: tsql

Find max value from coalesce function

This is my query: declare @t table (date1 date,date2 date,date3 date) insert into @t values (‘2019-01-01′,’2019-01-20′,’2019-02-10′) insert into @t values (null,null,’2019-02-01’) insert into @t …

Maximizing query performance by joining with XML

While working on query performance optimisation, I noticed that the pattern below outperforms by a wide margin other, more obvious, ways of writing the same query. After looking at the execution plans, it appears this is due to parallelism. The table MyTable, has a clustered primary key on (Identifier, MyId, date). The @xml variable usually contains tens of entries and

float to string no scientific notation: SQL Server

Have a problem with some wonky ID’s that I can’t quite figure out. The above is a result of joining two tables, where ID1 = ID2. ID1 cannot be null, however ID2 can be null. What I’m attempting to arrive at is: So I can then drop the other column. I’ve tried casting, str function, removing the period in the

Advertisement