Viewing 15 posts - 106 through 120 (of 1,957 total)
For those interest, here is the CASE query actual execution plan, where the optimiser has swapped out the CASE statement for the COMPUTED columns automatically.
January 19, 2016 at 5:36 pm
Eirikur Eiriksson (1/19/2016)
Jacob Wilkins (1/19/2016)
January 19, 2016 at 5:29 pm
Thanks for testing Orlando.
I wonder how the performance of each method will depend on how many "date columns" are present as well, whether having 20 columns vs 10 columns is...
January 19, 2016 at 8:03 am
You are probably best off using FOR XML PATH for this in my opinion.
Select
-- Make IdDoc an Attribute by prefixing with @
R.IdDoc [@IdDoc]
...
January 19, 2016 at 6:23 am
Just noticed "and the column header it belongs to", so:
SELECT MA.MaxDate, MA.ColName
FROM <mytable> AS MT
CROSS APPLY (
SELECT TOP(1) VA.LName, VA.LDate
FROM (VALUES('L1',MT.L1),('L2',MT.L2),('L3',MT.L3)....) VA(LName, LDate)
ORDER BY...
January 18, 2016 at 5:01 pm
You can also use APPLY
SELECT MA.MaxDate
FROM <mytable> AS MT
CROSS APPLY (
SELECT MAX(VA.LDate)
FROM (VALUES(MT.L1),(MT.L2),(MT.L3)....) VA(LDate)
) AS MA(MaxDate)
Excuse any slight syntax errors, I have typed this away from...
January 18, 2016 at 4:59 pm
Don't get confused into thinking that a CTE materialises the query inside it, it is just a query format structure and what you have there is a horrible mess.
I...
January 12, 2016 at 5:30 pm
Jeff Moden (1/8/2016)
Hugo Kornelis (1/8/2016)
Jeff Moden (1/7/2016)
Alan.B (1/6/2016)
You can't write a recursive CTE with using pre-CTE features.
Technically correct because only an rCTE can be an rCTE but the rather...
January 11, 2016 at 12:00 pm
No matter which output route you take, why not simply create a set with
key (order id?)
line (order line number/row_number())
data (nvarchar(max) fixed width data)
Insert the headers, all with [line] =...
January 11, 2016 at 11:57 am
You could try running SSMS with the /log switch.
This will write a log to your local user profile under %AppData%\Microsoft\AppEnv\10.0 called ActivityLog.xml
If you save the attached XSL file in the...
January 8, 2016 at 5:12 pm
NineIron (12/24/2015)
I'm using Report Builder and don't see any dropdowns or how to open in xml.
Instead of opening the report in report builder, download the rdl and open it with...
December 24, 2015 at 5:16 am
Try the dropdown list at the top of the properties window.
If that fails, open the report xml and search for it there.
December 23, 2015 at 5:30 pm
We use an SSRS "dashboard" for this, also an overnight SSRS report which lists any individual job step errors.
These are based on querying the agent logs in msdb.
December 17, 2015 at 4:33 pm
pete.ciskanik (12/17/2015)
December 17, 2015 at 4:30 pm
YSLGuru (12/14/2015)
SELECT T. Col1, T.col2FROM TABLE T
WHERE 1 = 1
There is a space after T. and before Col1 without the use of brackets and yet this works for some reason....
December 14, 2015 at 12:52 pm
Viewing 15 posts - 106 through 120 (of 1,957 total)