• rich_a_wms (11/27/2012)


    I found an extra space after the , and before the state in the city_state column. Problem solved and all is well. Thanks Jeff for taking the time and for your comments.

    Two things.

    1) The solution to your problem is a good example of why you should not store city and state in the same field.

    2) Your classic asp appears to be the beginning of a page that will use user input for city_state? The way you have this coded is wide open to sql injection attack. You should NEVER NEVER NEVER execute inputs from the user, especially on a website!!! You need to parameterize your queries, or even better, use stored procs to retrieve your data.

    _______________________________________________________________

    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/