November 17, 2015 at 7:54 am
WayneS (11/17/2015)
Ed Wagner (11/16/2015)
WayneS (11/16/2015)
Lynn Pettis (11/13/2015)
(think government contracted software development).My scary story when working with the gov't.
Software contract awarded, specified that all data access has to go through stored procedures.
They sent to me for my approval:
CREATE PROCEDURE xyz (
@ColumnList varchar(max),
@From varchar(max),
@Where varchar(max),
@Order varchar(max)
)
AS
declare @command varchar(max);
SET @command = 'SELECT ' + @ColumnList + ' FROM ' + @From;
IF @Where > '' SET @command = @command + ' WHERE ' + @Where;
IF @Order > '' SET @command = @command + ' ORDER BY ' + @Order;
EXECUTE (@command);
GO
Yep, that was the only procedure in the application.
They quickly learned to hate me.
That would be extraordinarily funny if it weren't true. Unfortunately, I have this feeling that you aren't joking.
Nope, not joking at all.
That is what we used to call "Malicious Compliance" and extremely high velocity pork was normally expressed to the perpetrators.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 17, 2015 at 8:23 am
Jeff Moden (11/17/2015)
jasona.work (11/17/2015)
I love it when I'm poking through topics that sound interesting, and come across something I've not done / seen before. Which then leads me down a rabbit hole to figure out (sometimes) *how* to do the thing in the topic...Case in point:
How to do a PIVOT led me down the rabbit hole of how to do a crosstab instead of a pivot...
So I converted a query I had, that was using PIVOT, to a crosstab. No performance gains (it's just a different way for me to check and display last backups for all my DBs, so not a lot of data,) but in some ways it's an easier to read query...
So, to paraphrase Neo "The One:" "I know crosstabs"
:hehe:
"It Depends". There's usually an minor performance gain in using CROSSTABs over PIVOTs but it's so small on today's machines, it's nearly trivial... unless... if the CROSSTAB or PIVOT is truly an aggregation, then pre-aggregation will help a whole lot and CROSSTAB (in such a case) will we roughly twice as fast at PIVOT.
For more information and some test code, please see the following article.
http://www.sqlservercentral.com/articles/T-SQL/63681/
As a personal preference, I prefer CROSSTABs rather than PIVOTs just from a readability point of view.
I also wouldn't call learning something new a "rabbit hole" no matter how cleverly disguised nor how deep the hole may be. 😀
That's actually the article I looked at to sort out how to do a crosstab.
Nah, for me learning something new is a rabbit hole, because I start out looking up how to do a crosstab and end up having taught myself how to speak Klingon...
:hehe:
November 17, 2015 at 8:40 am
WayneS (11/16/2015)
Lynn Pettis (11/13/2015)
(think government contracted software development).My scary story when working with the gov't.
Software contract awarded, specified that all data access has to go through stored procedures.
They sent to me for my approval:
CREATE PROCEDURE xyz (
@ColumnList varchar(max),
@From varchar(max),
@Where varchar(max),
@Order varchar(max)
)
AS
declare @command varchar(max);
SET @command = 'SELECT ' + @ColumnList + ' FROM ' + @From;
IF @Where > '' SET @command = @command + ' WHERE ' + @Where;
IF @Order > '' SET @command = @command + ' ORDER BY ' + @Order;
EXECUTE (@command);
GO
Yep, that was the only procedure in the application.
They quickly learned to hate me.
Holy...
Well, you won the Internet today as far as I'm concerned.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
November 17, 2015 at 9:56 am
Ed Wagner (11/17/2015)
Lynn Pettis (11/16/2015)
Ed Wagner (11/16/2015)
Lynn Pettis (11/16/2015)
And then you this type of question:************(11/16/2015)
How can i round off decimal number. E.g if i have 7.9---i need to round it off to 8, if i have 7.4---i need to round it off to 7...i tried round, ceiling.. but nothing got worked... please suggestI gave it a shot. We'll see if the shiny thing in my office is the crystal ball making an appearance or merely the sun beckoning me to go outside.
At least you have sunshine. Looks like snowy weather is coming here for here.
I saw that major snowstorm, but it looked like the brunt of hit was going to hit east of you. How did it turn out?
I think our turn is coming here soon enough. Yesterday was in the 60s and this weekend we're supposed to struggle to get up to 40 and see the first snow of the year. The timing is about right.
North side of town got more. Down here on the south side, some snow but a lot of ice. Yesterday as the storm hit my boss said we could work from home, come in, or take PTO. I was going to head, still may in the afternoon depending on the weather.
November 17, 2015 at 10:23 am
Lynn Pettis (11/17/2015)
OMG
Step 1: Prepare 3 envelopes. :hehe:
November 17, 2015 at 10:31 am
Luis Cazares (11/17/2015)
Lynn Pettis (11/17/2015)
OMGStep 1: Prepare 3 envelopes. :hehe:
ROFL.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
November 17, 2015 at 11:17 am
Sean Lange (11/17/2015)
Luis Cazares (11/17/2015)
Lynn Pettis (11/17/2015)
OMGStep 1: Prepare 3 envelopes. :hehe:
ROFL.
I thought step 3 was to prepare 3 envelopes.
November 17, 2015 at 11:30 am
8am yesterday
3pm yesterday
8am today
November 17, 2015 at 11:38 am
Send some of that snow my way, Steve?
November 17, 2015 at 11:38 am
djj (11/17/2015)
Lynn Pettis (11/17/2015)
OMGResume time.
Not touching that one with a ten foot pole.
Someone is probably getting fired.
November 17, 2015 at 11:47 am
Ed Wagner (11/17/2015)
Sean Lange (11/17/2015)
Luis Cazares (11/17/2015)
Lynn Pettis (11/17/2015)
OMGStep 1: Prepare 3 envelopes. :hehe:
ROFL.
I thought step 3 was to prepare 3 envelopes.
It's too late for that. Unless someone wants to share knowledge on DBCC TIMEWARP with that poor OP, then it might be too soon for that.
November 17, 2015 at 12:04 pm
Steve, your feet are conspicuously absent from the last photo. Bit chilly or so relaxed they're just buried in the snow?! 😛
November 17, 2015 at 12:06 pm
Steve,
Please send the sun east, but keep the snow.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 15 posts - 51,466 through 51,480 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply