Brian Sherwin's Blog

Moving at the Speed of .Net
posts - 98, comments - 62, trackbacks - 30

My Links

News

Twitter












Tag Cloud

Archives

Links

sql

There are 9 entries for the tag sql
Watch your procedure cache when using parameters
Dan Guzman had an enlightening post on how SQL server caches ad-hoc queries when using inline parameters. Basically the gist is that if your values for any given paramter changes you get variability in you cached procedure. However, if you specify the SqlDbType when adding your parameters, you can avoid this whole problem. Technorati Tags: sql...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Thursday, February 21, 2008 5:30 PM | Feedback (0) |

Example of a "GROUP BY" gone bad
OK, so I have been doing some presentations where I address this whole "bad GROUP BY" stuff, and I get the question, show me when it doesn't work. Here it is: Suppose you are to run a query that returns the Largest Order ever for all of your customers and the date that order was placed. We quickly run off to our SQL tool of choice and run the following: select CustomerID, CustomerName, Date, Max(OrderTotal) from Customers join Orders on Customers.CustID = Orders.CustID group by CustomerID, CustomerName,...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Friday, July 20, 2007 11:24 AM |

Insert Code Snippet...change of plugins
I had been using the "Insert Paste from Visual Studio" as a plugin for Windows Live Writer. Well, I found out today while changing blog skins that that particular plugin messes with the background styles and whopper-jaws the whole mess. So I went looking for another way to do code in Live Writer. I found this great plugin called "Insert Code Snippet..." It brings up a dialog window and allows me to pick the language for the code formatting. The cool thing about this is that I am not tied to what...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, April 24, 2007 4:04 PM | Feedback (2) |

SQL Don'ts (follow-up) - The Correct way to GROUP BY
I had some people write and ask why I said the following GROUP BY was "just wrong" because they felt "It Works!" SELECT C.CustomerID, CustomerName, City, State, Sum(Sales) as TotalSales FROM Customers C INNER JOIN Sales S on C.CustomerID = Sales.CustomerID GROUP BY CustomerID, CustomerName, City, State Let me respond by saying: Do you really want to group by City? or State? or CustomerName? To that I better get a "NO!" response. What you are really asking for is that by CustomerID, give the total...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, April 16, 2007 10:53 AM |

SQL Developer Don'ts (Part 1)
I'm going to start a series of short posts on stupid things developers do that they shouldn't. Some of these have been preached for years, some are just developers don't know any better. So here goes...starting with security! #1: Never use the SA account in a production database. I worked with a company that purchased a time and billing database that was developed as a web application. Cool thing was that when we installed it, we had to change the SA password per their setup guide. When we looked...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, January 30, 2007 3:37 PM | Feedback (1) |

What is Threat Analysis and Modeling?
OK. I'll revise what I said in an earlier post about this tool. You shouldn't change your vocabulary to Secure Development Lifecycle--but you definitely need to add it to your development practices. Security should start at the envisioning phase and proceed all the way to deployment. How many times has an application been created where the deployment had to be insecure because of the way the developers put it together? As a consultant, I've seen developers use “SA“ for the SQL connection,...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, March 13, 2006 12:30 PM | Feedback (0) |

Posting long overdue
This is weird. You would think that with a broken hip, I would have had all the time in the world to blog about everything. Oddly enough, healing was a busy process in and of itself. I didn’t even take the time to post the details of the accident. Partly, because I don’t want my blog to be a diary (like some of the ones I ended up “unsubscribing”). So now that I am back to a regular schedule of sorts, I will try to regularly post. Probably mostly on Yukon, Whidbey, etc as...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, March 21, 2005 9:17 AM | Feedback (0) |

SQL Clustered Indexing--Lengthy post
Clustered Index Details As promised here are some more details on clustered indexing. For those of you who always wondered what that little checkbox was when you were creating an index in SQL Enterprise Manager, I hope to clear up a bit of the confusion. I need to work on adding some diagrams to this, but hopefully this will be helpful. I will try my best to do this without trying to rehash the SQL Books Online… So first, I guess it would be prudent to start at the beginning. When you create...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Thursday, December 16, 2004 5:57 AM | Feedback (7) |

Clustered Indexes in SQL 2000
OK— So I am teaching SQL Administration this week, and I come across an example of database objects in SQL. Now, I have taught this class at least 10 times over the last three years and it has never really bothered me, but today it did. Probably because I have donXML’s article on “Viral Coding Examples…” In this particular example, they were showing a clustered index on the Lastname of a customers table. Now, why is that a “bad” thing? Well, first an investigation...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, November 08, 2004 9:29 AM | Feedback (7) |

Powered by: