0

I cannot use STRING_SPLIT in my version of SQL Server (I got

Valid values of the database compatibility level are 80, 90, or 100

-When I tried to set it to 130). I have a simple input variable coming from my ASP.Net app.

@Keyword nvarchar(50)

It could be a single word, like 'flood' or it could be a semi-colon separated group of words, like 'flood; damage'. I need to separate each word to run in the rest of my script. How would I do this without using STRING_SPLIT?

gwydion93
  • 1,681
  • 3
  • 28
  • 59
  • It sounds like you are running SQL Server 2008, in which case you can't use the `STRING_SPLIT` function. You should be able to confirm your version by running `SELECT @@VERSION`. If you are running a version before 2016, then you should read the following article (and the follow up articles) [Split strings the right way – or the next best way](https://sqlperformance.com/2012/07/t-sql-queries/split-strings) – GarethD Jul 01 '19 at 14:18
  • Yes, I am running 2008. – gwydion93 Jul 01 '19 at 14:20
  • 1
    A warning if you are using 2008; SQL Server 2008 has about 7 days left of (extended) support left. You need to consider your upgrade paths as soon as possible. – Thom A Jul 01 '19 at 14:25
  • 1
    Personally I suggest one of the answers using the XML Splitter; or you can use Google/Yahoo/Bing/DuckDuckGo/etc to search for `DelimitedSplit8k` (you'll need `DelimitedSplitN4K` from the article for an `nvarchar`). – Thom A Jul 01 '19 at 14:27
  • This looks incredibly complicated for such a simple task. Doing this on the front end would require multiple calls to the SP and I don't want that either. :- ( – gwydion93 Jul 01 '19 at 14:40

0 Answers0