• DaveK2014 (5/2/2014)


    I am trying to run the query below. Between the %% will be certain text that we are looking for.

    The problem is the union blows up because optionlongdesc is a ntext field. Any thoughts on how to make this work?

    Thanks

    Yes, change your table to use nvarchar(max) instead. the (n)text datatype has been deprecated. It is a pain to work with. You can't index it and you have to constantly convert it to a max datatype in order to use a where clause.

    http://msdn.microsoft.com/en-us/library/ms187993.aspx

    If you can't change the table you will have to do a convert in your query. You shouldn't have any issue changing the column to nvarchar(max) from ntext.

    _______________________________________________________________

    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/