• erikd (11/7/2013)


    I don't use any VARCHAR columns; they're all NVARCHAR, though I do control their sizes in increments of 64 to keep data from being truncated.

    I've gotten some feedback that this is inappropriate, but I receive dozens and dozens of Excel files a week that I have to import and make sense of (no control over their generation). Going back to correct Unicode or UTF characters showing up as question marks in VARCHAR columns would put me on Queasy Street. Especially if they make it to a live server.

    Since taking advice from a Kevin Boles talk and querying them with N'' I've noticed a definite improvement in performance, but since this looks like a lively talk on the subject...

    Am I doing it wrong?! :blush:

    I personally believe in typing columns to what they need to be, so understanding the underlying data is quite important. Of course, when your data is coming in uncontrolled, like through Excel, it is usually better to be safe than sorry.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St