January 4, 2017 at 8:51 am
Hugo Kornelis (1/4/2017)
Note that both for the versions in your post as well as for the versions given by Eirikur, only some work correctly for nullable columns.
I don't think any of them really work 'correctly' for NULLs in the data, I mean none are going to return just the rows where Col IS NULL when a NULL is passed.
I'll add a comment to the blog post mentioning that I'm only dealing with NOT NULL columns (the alternative is far more complicated that I ever want to deal with)
I consider all of these to be bad ideas.
Likewise.
Another pattern that I have used is
IF @C1 IS NOT NULL
BEGIN;
SET @Qry += ' AND Col1 = @C1';
END;
(...)
EXEC sp_executesql @Qry, '@C1', @C1;
That one at least performs well. π
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 4, 2017 at 8:55 am
GilaMonster (1/4/2017)
Hugo Kornelis (1/4/2017)
Note that both for the versions in your post as well as for the versions given by Eirikur, only some work correctly for nullable columns.I don't think any of them really work 'correctly' for NULLs in the data, I mean none are going to return just the rows where Col IS NULL when a NULL is passed.
True. But some of them at least return all data when a NULL is passed in; others return only the non-NULL values.
Usually, for this type of dynamic search criteria is to return everything when NULL is passed in and matches when something else is passed, so the former would qualify as "correct" by that definition.
January 4, 2017 at 9:00 am
Hugo Kornelis (1/4/2017)
GilaMonster (1/4/2017)
Hugo Kornelis (1/4/2017)
Note that both for the versions in your post as well as for the versions given by Eirikur, only some work correctly for nullable columns.I don't think any of them really work 'correctly' for NULLs in the data, I mean none are going to return just the rows where Col IS NULL when a NULL is passed.
True. But some of them at least return all data when a NULL is passed in; others return only the non-NULL values.
Good point. I'll flag the ones that don't behave correctly.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 4, 2017 at 10:55 am
Testing and bug fixes for the forum upgrade is going well.
Right now we have a final test release set for Tues, Jan 10 and the final deployment for early UK time on Thur, Jan 12.
January 4, 2017 at 10:59 am
Steve Jones - SSC Editor (1/4/2017)
Testing and bug fixes for the forum upgrade is going well.Right now we have a final test release set for Tues, Jan 10 and the final deployment for early UK time on Thur, Jan 12.
That is great news. Thanks to you and the whole team that have been working on this. π
_______________________________________________________________
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/
January 4, 2017 at 1:09 pm
Sean Lange (1/4/2017)
Steve Jones - SSC Editor (1/4/2017)
Testing and bug fixes for the forum upgrade is going well.Right now we have a final test release set for Tues, Jan 10 and the final deployment for early UK time on Thur, Jan 12.
That is great news. Thanks to you and the whole team that have been working on this. π
Yes, really good news. Thanks for the investment of time and effort. I know it was significant. Here's to a good release. π
January 5, 2017 at 7:03 am
Does anyone have any idea why a thread I created yesterday
http://www.sqlservercentral.com/Forums/FindPost1847804.aspx
appears to have removed or marked as spam?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
January 5, 2017 at 7:18 am
Phil Parkin (1/5/2017)
Does anyone have any idea why a thread I created yesterdayhttp://www.sqlservercentral.com/Forums/FindPost1847804.aspx
appears to have removed or marked as spam?
Maybe you were selling kitchens? Or fake documents? :hehe:
January 5, 2017 at 7:24 am
Luis Cazares (1/5/2017)
Phil Parkin (1/5/2017)
Does anyone have any idea why a thread I created yesterdayhttp://www.sqlservercentral.com/Forums/FindPost1847804.aspx
appears to have removed or marked as spam?
Maybe you were selling kitchens? Or fake documents? :hehe:
Dammit, I was going to use those links to the cricket streams you posted.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
January 5, 2017 at 8:07 am
Luis Cazares (1/5/2017)
Phil Parkin (1/5/2017)
Does anyone have any idea why a thread I created yesterdayhttp://www.sqlservercentral.com/Forums/FindPost1847804.aspx
appears to have removed or marked as spam?
Maybe you were selling kitchens? Or fake documents? :hehe:
Of course not. It was a totally valid question about optimising the retrieval of cash from Nigerian bank accounts.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
January 5, 2017 at 10:23 am
Phil Parkin (1/5/2017)
Of course not. It was a totally valid question about optimizing the retrieval of cash from Nigerian bank accounts.
Thanks I needed a good laugh. :laugh:
Head cold today so I am feeling bad, so this helped.
January 5, 2017 at 1:28 pm
Phil Parkin (1/5/2017)
Luis Cazares (1/5/2017)
Phil Parkin (1/5/2017)
Does anyone have any idea why a thread I created yesterdayhttp://www.sqlservercentral.com/Forums/FindPost1847804.aspx
appears to have removed or marked as spam?
Maybe you were selling kitchens? Or fake documents? :hehe:
Of course not. It was a totally valid question about optimising the retrieval of cash from Nigerian bank accounts.
I can only guess someone reported something, or there was a mistake. We try to hide and not delete SPAM, but perhaps someone made a mistake.
Apologies.
January 5, 2017 at 5:34 pm
Ed Wagner (1/4/2017)
Sean Lange (1/4/2017)
Steve Jones - SSC Editor (1/4/2017)
Testing and bug fixes for the forum upgrade is going well.Right now we have a final test release set for Tues, Jan 10 and the final deployment for early UK time on Thur, Jan 12.
That is great news. Thanks to you and the whole team that have been working on this. π
Yes, really good news. Thanks for the investment of time and effort. I know it was significant. Here's to a good release. π
Awesome news. I agree. Thanks for taking the time for the improvements! I just don't know what they are, yet. π
--Jeff Moden
Change is inevitable... Change for the better is not.
January 9, 2017 at 5:28 am
Quick random question that isn't really worthy of its own thread. Given that the log redo process in an AlwaysOn Availability Group secondary can be likened to a continuous restore, how are we able to read the database, given that it's not conveniently going into Standby when we need it to. Is just because of the snapshot isolation level?
I know it probably sounds obvious, but I don't want to assume anything. Thanks.
January 9, 2017 at 8:55 am
Beatrix Kiddo (1/9/2017)
Quick random question that isn't really worthy of its own thread. Given that the log redo process in an AlwaysOn Availability Group secondary can be likened to a continuous restore, how are we able to read the database, given that it's not conveniently going into Standby when we need it to. Is just because of the snapshot isolation level?I know it probably sounds obvious, but I don't want to assume anything. Thanks.
MS Magic.
They control the process, so you are essentially in standby.
Viewing 15 posts - 57,031 through 57,045 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply