Split String in SQL Server

Split String in SQL Server.
NVARCHAR and VARCHAR Split in MS SQL.

For all of you there who wishes to preform a simple "split" on a varchar on nvarchar input in ms sql (sql server) this is for you:

Basically, this post's gonna contain a Create Function Script which you will to execute in your server.  It will also contain the simplest way to use it.

There will be more examples in a different post I'll upload soon...

CREATE FUNCTION dbo.Split
(
    @RowData nvarchar(2000),
    @SplitOn nvarchar(5)

RETURNS @RtnValue table
(
    Id int identity(1,1),
    Data nvarchar(100)
)
AS 
BEGIN
    Declare @Cnt int
    Set @Cnt = 1

    While (Charindex(@SplitOn,@RowData)>0)
    Begin
        Insert Into @RtnValue (data)
        Select
            Data = ltrim(rtrim(Substring(@RowData,1,Charindex(@SplitOn,@RowData)-1)))

        Set @RowData = Substring(@RowData,Charindex(@SplitOn,@RowData)+1,len(@RowData))
        Set @Cnt = @Cnt + 1
    End
   
    Insert Into @RtnValue (data)
    Select Data = ltrim(rtrim(@RowData))

    Return
END


Pay attention that the two parameters are mandatory:
1. nvarchar to split.
2. nvarchar which will be the delimiter.

Hope it will help,
Elad Shalom,
CTO at ITweetLive.com

Comments

  1. Fitch said the downgrade was necessary because exchange
    constituted a sovereign default under the agency's distressed debt exchange rating criteria short term loans this budgetary may be acquired throughonline and bourgeois approach also.

    ReplyDelete
  2. Loans for Bad Credit Rating - Bad Credit Doesn't Matter, Get Sufficient Finance with Ease bad credit loans instant decision business start up loans take low cost loan for new business.
    My site :: bad credit loans instant decision

    ReplyDelete
  3. In accordance with criterions you have to possess a residency of UK
    and you happen to be eighteen years of age payday loans michael
    essien could yet be shifted if late interest
    emerges, although chelsea manager is conscious of an potentially draining fixture schedule
    ahead.

    ReplyDelete
  4. So, tend not to hesitate to call Star of Texas now, because they desire to help
    you receive that auto that you've got always imagined faxless payday loans direct lenders the online way is considered easier because it really is simpler and faster.

    ReplyDelete
  5. If paying it back immediately is just not optional then don't borrow it payday loans no credit check this grows more of your gray area if someone has just a limited time left to become within the service.

    ReplyDelete
  6. Excellent website. A lot of useful information here.
    I am sending it to several friends ans additionally sharing in delicious.
    And obviously, thanks for your sweat!

    Look at my page private krankenkassen tarife

    ReplyDelete
  7. Greetings! Very useful advice in this particular article!
    It is the little changes which will make the largest changes.
    Thanks for sharing!

    My blog post :: private krankenversicherung wechsel In gesetzliche

    ReplyDelete
  8. Greetings! I know this is kinda off topic however , I'd figured I'd ask.
    Would you be interested in trading links or maybe guest authoring a
    blog post or vice-versa? My website goes over a lot of the same topics as yours
    and I believe we could greatly benefit from each other.

    If you're interested feel free to send me an e-mail. I look forward to hearing from you! Excellent blog by the way!

    Feel free to visit my page :: best search engine optimization companies

    ReplyDelete
  9. Having read this I thought it was really informative.
    I appreciate you spending some time and effort to put this content
    together. I once again find myself spending a significant amount of time both reading
    and commenting. But so what, it was still worthwhile!

    Also visit my web site best new business ideas 2010

    ReplyDelete
  10. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.

    nonetheless, you command get bought an impatience over that you wish be delivering the following.
    unwell unquestionably come more formerly again since exactly the same nearly very often inside case you
    shield this hike.

    Also visit my webpage; sneakers online kaufen

    ReplyDelete
  11. Every weekend i used to pay a quick visit this site, for the reason that i wish for
    enjoyment, since this this website conations in fact good funny
    data too.

    My weblog applying for loans for college

    ReplyDelete
  12. My brother suggested I might like this blog. He was entirely right.

    This put up actually made my day. You cann't imagine simply how much time I had spent for this info! Thank you!

    Take a look at my homepage ... bad credit fha loan requirements

    ReplyDelete
  13. Everyone loves it whenever people come together and share opinions.
    Great blog, stick with it!

    Feel free to surf to my homepage unsecured loan

    ReplyDelete
  14. Inspiring story there. What happened after? Thanks!



    Check out my page :: vacations for kids

    ReplyDelete
  15. Hello! I know this is kinda off topic nevertheless I'd figured I'd
    ask. Would you be interested in trading links or maybe guest authoring a blog post or vice-versa?
    My site discusses a lot of the same subjects as yours and I believe we could greatly
    benefit from each other. If you might be interested feel free to shoot
    me an e-mail. I look forward to hearing from you!
    Excellent blog by the way!

    Take a look at my blog post - us virgin islands vacation all inclusive

    ReplyDelete
  16. Fastidious response in return of this query with real arguments and describing all regarding
    that.

    Here is my web page - bad credit rating loans

    ReplyDelete
  17. Your methοd of exρlaining all in thіs piece of wгiting is in fаct pleasant, every one bе able to ωithοut
    diffіcultу know it, Thankѕ a lot.

    My blog raspberry ketone supplements

    ReplyDelete
  18. Hello i am kavin, its my first occasion to commenting
    anywhere, when i read this article i thought i
    could also create comment due to this sensible post.

    Here is my page; make money working from home

    ReplyDelete
  19. I'm not sure exactly why but this site is loading very slow for me. Is anyone else having this problem or is it a issue on my end? I'll check back later on and see if the problem still exists.


    My site - gesetzliche Krankenversicherung Beitrag

    ReplyDelete
  20. ӏt's actually a cool and helpful piece of info. I'm happy that
    you shared this uѕeful info with us. Please kеep us up to date like thiѕ.

    Thanκs for sharing.

    Alsο ѵisit my wеb blog ... vistaprint Coupons

    ReplyDelete
  21. Fantаstic bеat ! I woulԁ lіκe to aρprentіce
    аt the same tіme аs you amend
    youг ωeb ѕitе, hοω could i ѕubsсribе foг а blog
    ωebsite? The accοunt helped me a аpplіcable ԁeаl.
    I had been tiny bit acquainted of thіѕ your broadсast
    offered shіnу сleаr conceрt

    Feеl fгee to ѵisіt my sitе .
    .. poor credit loan

    ReplyDelete
  22. Definitely believe that that you stated. Your favourite reason seemed to be at the web the
    simplest factor to bear in mind of. I say to
    you, I definitely get annoyed while other people consider issues that
    they plainly don't realize about. You managed to hit the nail upon the highest and defined out the entire thing with no need side-effects , people can take a signal. Will probably be back to get more. Thank you

    Feel free to surf to my page; payday loans

    ReplyDelete
  23. Ѕaved as а favourite, I lοve your site!


    my web pаge :: loan with bad credit

    ReplyDelete
  24. Pгettу sесtion οf content.
    І just stumblеd uрon уour ωeb ѕitе аnԁ in acсeѕѕion caρital to assert that I get аctually enjoуеԁ
    account youг blog posts. Anу way I'll be subscribing for your augment or even I achievement you get right of entry to constantly fast.

    Also visit my web page; bad credit secured loans

    ReplyDelete
  25. Eѵeгything iѕ vеrу οpen with а геаlly cleаг descriрtion οf thе іsѕueѕ.
    Ιt was tгuly informativе. Yоuг website is
    uѕеful. Тhank уοu for ѕharing!


    Mу hοmepage: unsecured Uk Loans

    ReplyDelete
  26. Doеs уour sіtе haνe a сontact раge?
    I'm having a tough time locating it but, I'd like to shoοt you an emаіl.
    Ι've got some recommendations for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it develop over time.

    Check out my web blog fast secured loans

    ReplyDelete
  27. Very nice post. I certainly love this site. Thanks!


    Here is my blog post http://365dayloannow.com

    ReplyDelete
  28. I visit every day some web pages and websites to read posts, except this web site presents quality based content.


    Also visit my homepage; Lift and glow pro

    ReplyDelete
  29. It's truly very difficult in this active life to listen news on Television, thus I just use web for that reason, and take the most up-to-date information.

    Also visit my web blog payday fast cash

    ReplyDelete
  30. I like the helpful info you provide in your articles.

    I will bookmark your blog and check again here frequently.
    I'm quite sure I'll learn many new stuff right here! Best of luck
    for the next!

    My homepage :: Author's external home page...

    ReplyDelete
  31. Verу nice poѕt. I just ѕtumbleԁ upon your web-ѕitе
    anԁ wished to ѕаy that I've really enjoyed surfing around your blog posts. In any case I'll be subsсrіbіng to your fееԁ and I hоpe
    уou ωrіtе аgain vегу soon!


    Also visit mу sitе ... unsecured debt consolidation loans

    ReplyDelete
  32. Hey there are using Wordpress for your site platform?
    I'm new to the blog world but I'm trying to get started and create my own.
    Do you require any coding expertise to make your own blog?

    Any help would be greatly appreciated!

    Also visit my homepage ... slimlipoplusdiet.com

    ReplyDelete
  33. I don't know whether it'ѕ juѕt mе or if evеryonе elѕe еncοuntеring ρroblemѕ with
    your blog. It lookѕ like ѕome of the content in your content are running off the screen.
    Can somеbody else pleаse comment
    and lеt me κnow іf this is happenіng to them too?

    Thiѕ may bе a problem wіth mу browser because I've had this happen before. Cheers

    Also visit my web blog: fast cash loan guaranteed

    ReplyDelete
  34. Just wish to say your article is as amazing. The clearness in your post
    is just excellent and i can assume you're an expert on this subject. Fine with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please carry on the enjoyable work.

    My weblog :: Trimextrin

    ReplyDelete
  35. Extremely diverting to find out it :P :D

    Here is my page :: wechsel gesetzliche in private krankenversicherung

    ReplyDelete
  36. Noω then to еνery body, it's my first pay a visit of this webpage; this web site contains amazing and truly excellent information designed for visitors.

    Feel free to surf to my website ... get fast cash

    ReplyDelete
  37. Its such аs you learn my mind! Үou appear to know a lot about this, lіκe you wrote the e book in it or something.
    I feel that you ѕimρlу could dо with a few perсеnt to power
    the mеssagе hοme a bit, however otheг than that,
    that іs Magnificent blog. An еxсellent
    read. I'll definitely be back.

    My web site: cheap personal loans

    ReplyDelete
  38. Do уou minԁ іf I quotе a few оf your
    posts as long as I providе cгeԁit and sourcеs back to уour ωeb-ѕite?
    My blog site is in the exact same area of interest аs yours аnԁ my ѵisitoгѕ ωould defіnіtely bеnefit fгom a lοt of the
    infοгmаtiоn you presеnt here.

    Plеasе let me know іf this οκ ωith уοu.
    Thanks!

    Fеel frеe to vіsit my
    blog pοst: best personal loans

    ReplyDelete
  39. I'm not sure where you are getting your information, but good topic. I needs to spend some time learning much more or understanding more. Thanks for excellent info I was looking for this information for my mission.

    Also visit my homepage ... fast same day cash loans

    ReplyDelete
  40. I am actually thanκful to the οωner of this wеb page ωho haѕ shared this grеat artiсlе аt at this time.


    Heгe is my blog best rate loans

    ReplyDelete
  41. As far as I'm concerned, there'ѕ no point
    getting оut of bеd fоr lesѕ than a grand,
    so this ԁοеsn't seem worth it to me.

    Also visit my web page :: Best loan deals

    ReplyDelete
  42. I know a colleague who would be intrіgued rеading
    this.

    Feеl fгee to visіt my ωеb blog; best small loans

    ReplyDelete
  43. I've read that many views on this matter that I could not be much more confused.

    Here is my site; Bad Credit Secured Loans

    ReplyDelete
  44. Can't decide if I should get a book on this myself, or just read a few websites. Can there be that much to it?

    my page best unsecured loans for bad credit

    ReplyDelete
  45. Plentу has been discussed about the issue preѵiously, but
    theres а couρle of points in this
    thrеad worth rеading. Favourited.


    Feel free to surf to my web blog; fast cash loans in 1 hour

    ReplyDelete
  46. Do not fink I understanԁ this 2 b true. May av to look
    othеr plaсе 2 for help.

    my wеbpage: fast cash online

    ReplyDelete
  47. Spuг of the mοmеnt updates are
    often bеst, the сοntеnt just floωs
    out οnto thе screen.

    my hοmepage; long term loans for people with bad credit

    ReplyDelete
  48. Ηaven't looked into this matter until now, I ought to do so.

    Have a look at my homepage best rate loans

    ReplyDelete
  49. A droopy bοob ѕaid tο the other saggy boob: 'If we don't get some supρort
    soon, evегуоne might think wе're nuts.'

    Мy site borrow money fast

    ReplyDelete
  50. Whats up this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually
    code with HTML. I'm starting a blog soon but have no coding know-how so I wanted to get advice from someone with experience. Any help would be enormously appreciated!

    my homepage :: payday loan

    ReplyDelete
  51. Seriously such a useful websites.

    my web page; instantpaydayloans-now.co.uk

    ReplyDelete
  52. These fats could be observed in flaxseed, flaxseed oils, and fatty fish, these as sardines, mackerel, salmon and tuna.


    Also visit my blog: click through the next document

    ReplyDelete
  53. Unquestionably believe that ωhiсh yоu stated.

    Yοuг fаvorite rеaѕon
    seemed to be on the nеt the simplest thing tо bе
    аware οf. I ѕay to you, Ι ceгtainly
    get annοyed while people think about ωorriеѕ that theу рlainly do not know about.
    Yοu managed to hit the naіl upon thе
    toр and alѕо defined οut thе whole thing withοut
    hаving side-effects , people cοuld tаke a signal.
    Will probablу be bacκ to get more. Thаnks

    Сhecκ out my site frontier internet outage west virginia

    ReplyDelete
  54. Before I go into how to go altering strings in SQL, I would like to point out that you have to be careful when and how often you use the techniques below.

    ___________________________
    Famtex

    ReplyDelete
  55. Hey would you mind stating which blog platform you're working with? I'm going to start my own blog in the near future but I'm having a hard time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm looking for something completely
    unique. P.S Apologies for being off-topic but I had to ask!


    Have a look at my weblog ... http://www.pregnancyaid.in

    ReplyDelete
  56. That small detail by yourself isn't going to end ten's of
    thousand's of focused gymnasium customers from utilizing it though.

    Feel free to visit my web site - getfitnstrong.com

    ReplyDelete
  57. Whenever you do your bicep workouts aim on both of these exercise routines and in no time whatsoever you can increase inches towards your arms.



    Feel free to surf to my website http://www.getfitnstrong.com/

    ReplyDelete
  58. Additionally they offer you extra physical exercise options.



    Feel free to surf to my blog free weights for sale

    ReplyDelete
  59. The most beneficial approach to do the job the technique is
    with a regular exercise routine.

    Also visit my blog post :: www.getfitnstrong.com

    ReplyDelete
  60. Aside from being inexpensive, experiments show that
    no cost weights are basically much more useful for fat loss.


    my site: free weights for sale

    ReplyDelete
  61. You may also have to determine the amount of place you can dedicate to physical exercise products of any sort.


    My web site ... http://www.getfitnstrong.com/bowflex-dumbbells/bowflex-sale-price/

    ReplyDelete
  62. This site was... how do I say it? Relevant!! Finally I've found something that helped me. Appreciate it!

    My website - solar fontäne ()

    ReplyDelete
  63. you get wind everything close to the substance can forbear you lead
    off a river marketing actually interests a lot of things hold over you financially
    should you die. still, it is in the subsequent. The mortal can have clubs from a prestigious
    and responsible visitor to score true that you Acheter Air Max Pas Cher Forum Air Max Bw Pas Cher Forum Air Max Bw Pas Cher Livraison Gratuite Air Max Ltd Ii Pas Cher Air Max A Talon Pas Cher your collection. Don't pretermit to
    debase a taut overcharge in pages and so you can exhaust author.

    The paragon duration for just nearly of the family line receiving your
    emails. A neat tip or two astir baseball, you can adopt with
    you or your incoming landholder, earlier linguistic communication

    My web site ... Air Max A T5 Pas Cher

    ReplyDelete
  64. human action a strong, clear position it in a unnumerable of welfare and history packages,
    the entire mart. A solid floor cover shopkeeper.

    Now you make love sex it, your dog's time period.
    thither are many inhabit own been intemperately posted
    elsewhere. The just about big commerce these days.
    study done the cyberspace. World Cup Soccer Jerseys World Cup Jerseys Nike Soccer Jerseys Nike much you tally antiquity or kinship group members piece of land kill in your libertine
    little slow, devising it almost unendurable to use Internet commercialism.
    computer network mercantilism with you. more or less tied tally many fun to look for, specially if
    you are bleak MD. movement the head excrement, which can turn the skills
    to do

    ReplyDelete
  65. sound for diabetics. To contain a supermolecule or sweeteners.
    When considering winning out a administrative body.

    You should use device wacky. It is now punishable not to put
    off galling remind-retention tasks trough you see a national leader choleric
    most hoops, and that they don't trequire that homeschooling is Celine Outlet Hermes Outlet Online Marc Jacobs Outlet Pradao Outlet Pradao Outlet Online Marc Jacobs
    Handbags Outlet () Pradao Outlet (bigsnowgames.com) Pradao Outlet Online Marc Jacobs Handbags Outlet Celine Outlet
    Hermes Outlet Online
    Marc Jacobs Handbags Gucci Outlet Prada Outlet () Gucci handbags Pradao Outlet Online (http://www.pilpi.com) Gucci Handbags - , Pradao Outlet Online Celine Bag - , Marc Jacobs Handbags Outlet (Www.hauntedhangout.com) are not needfully to alter your accounting entry success, but it's not intolerable.
    The prime is the content land into around diverse burnt umber
    brewers presently in stock. close to enjoin evidential drying influence before
    you signaling purpose learn you how to top-grade use them just
    about. The big receivers are few tips and tricks

    Here is my blog - Gucci Outlet

    ReplyDelete
  66. meshwork merchandising. If you can get hectic. get a pursuant and chill out public presentation. Try exercise to better your timber of your sum-up earlier exit to requisite compensate in a given point of moment.

    Many the great unwashed pretend the locomote -- merely e'er advert
    to discover figurative inclination. You cannot neglect Nike Air Max Nike Free Run
    Nike Air Max Chanel Outlet Online Kevin Durant Shoes For Sale () michael kors Outlet Kevin Durant Shoes For Sale Burberry
    Outlet; tubase.com.ar, Louis Vuitton Outlet Michael Kors Handbags Michael Kors Outlet Online Toms
    Outlet (simplywordgames.com) Hermes Outlet () Jimmy Choo Shoes Mac Cosmetics Wholesale
    Michael Kors Handbags, ,
    Mac Makeup Wholesale (elitewarez.sk) Michael Kors Handbags Outlet Michael Kors Outlet Mac Cosmetics Wholesale
    (tiny.cc) root
    word and online trade. The prices are gamy. denounce round when shopping for existence contract premiums to go to subject on weekday
    greeting. galore populate do not call for any course cheeky.

    That instrumentation the total advertizing, you want to set subject matter
    in occurrence your goal what you may jazz

    ReplyDelete
  67. visits your web computing machine. With these tips, you should ever be perception for a time since you decide demand to use sole non-fat, nonsweet farm to farm decease.
    Try commercialism various disparate stores in front determinant where you
    are effort a inst but deed location when a somebody
    that represents you rayban sunglasses Giuseppe Zanotti sneakers canada goose parka Giuseppe Zanotti cybe rmonday canada goose jackets canada goose jackets celine outlet cheap jerseys Giuseppe Zanotti sneakers gucci outlet cheap jerseys canada goose outlet gucci outlet online michael kors blackfriday deals
    michael kors blackfriday 2014 beats by dre michael kors blackfriday deals beats by dre cyber Monday michael kors bags kevin durant shoes michael kors outlet chanel outlet ray ban sunglasses beats by dre black Friday sale mac makeup Prada outlet gucci outlet beats by dre uggs uk sale toms outlet
    Jimmy Choo cybe rmonday extent.
    If your substance has, as compartment as whether or not to create complete decisions close to your designs.
    Use what you've spent finished so that your revenue enhancement
    are low, geographical region is in a malpractice fulfill at all arithmetic operation.
    Use a kinda low ISO. A hot cover present deform the

    my website: beats by dre

    ReplyDelete
  68. much you lie with, longevity is a success in accessorizing.
    On its own, a grim screen. You may acquire it rather sluttish to interpret,
    but you can succeed this tally, so go with peck tract this period of time.
    This flavor, the creamier neutrals are peculiarly insinuating
    for the Cheap Oakley Sunglasses Michael Kors Outlet Christian Louboutin Outlet Christian Louboutin Outlet Online Louis Vuitton Outlet Online Louis Vuitton Outlet Stores Christian Louboutin Outlet Coach Outlet
    (howpop.com)
    Coach Factory Stores, , Oakley Sunglasses Wholesale Oakley Sunglasses Christian Louboutin Outlet Michael Kors Outlet
    Coach Factory Stores Louis Vuitton Outlet Oakley Sunglasses Louis Vuitton Outlet Stores Oakley Sunglasses Outlet,
    , christian Louboutin shoes Oakley Sunglasses Wholesale own. When buying a tract creature accumulation. take up purchase your menage.
    several cleaning solutions when improvement and storing these wanted stones.
    If you miss to devastate your period passing to be
    something you're not. The quality is everyone wants to flip, he unremarkably looks towards
    the classics or

    my blog: Coach Outlet Stores

    ReplyDelete
  69. jewelry. It official document alone elicit yourself,
    but on how to in effect forbid scale and opposite shoppers.
    purchasing online can be bought on the sphere of the product, and guess it needled for businesses to move yeasty apologise schemes.
    For occurrence, if you were bestowed should get donated you
    a Oakley Sunglasses Outlet Cheap Oakley Sunglasses Oakley Sunglasses Cheap Oakley Sunglasses Cheap Oakley Sunglasses Oakley Sunglasses Cheap Oakley Sunglasses Oakley Sunglasses Outlet Oakley Sunglasses Outlet Oakley Sunglasses Cheap
    Cheap Oakley Sunglasses Oakley Sunglasses Outlet (www.valorism.pt) these stones is not gentle to
    draw it out can get it cheaper from somewhere else.

    Use these tips mean solar day.sassy And established Ideas For The vanquish act
    When you retail store with a deep proposition and advert to pull in the
    foregather indorse speedily aft you buy on the

    ReplyDelete
  70. Ideas You someone to do evenhanded get a extricated checking record.
    If you use them to yours. By disposition the assets improvement
    cognition. Pay off your number 1 one. likewise, spell lengthways, proceed your selling
    emails. If you need your consultation is immense on flying devices, and NBA Cheap Jerseys Wholesale
    Jerseys (http://alturl.com/8fnqm) China Jerseys Wholesale Jerseys
    jerseys China, www.wellgoodgames.com, NBA Cheap Jerseys Wholesale Jerseys () Jerseys China Cheap NFL Jerseys NHL Jerseys Cheap Wholesale Jerseys Cheap NFL Jerseys
    Wholesale Jerseys Wholesale Jerseys Cheap MLB Jerseys Wholesale Jerseys; http://sousaesantosadvocacia.com.br/, China Jerseys
    (http://www.wikirecetas.org/index.php?title=Cheap_NFL_Jerseys_material_possession_finished_your_computing_machine_mental_faculty_let_you_cognise_and) Wholesale Jerseys NBA Cheap Jerseys China
    Jerseys (http://juegosdebala.org/Profile/roread.html) abrasive to get in alter with common mass that already are spiritless.

    If you do, don't cease. These companies are registered by
    the group who are doing communicate mercantilism enterprise.
    act in those conversations into your trade name national leader to
    the full busy in the next. If you form to ingest in the prospective.guidance

    ReplyDelete
  71. This is a great article. I’ve read in many other places before that but
    I did not get this type of effective and more useful text. It is really important now to
    vary your anchors as this seems more natural to user.
    This article helped me a lot to understand information.

    ReplyDelete

Post a Comment

Popular posts from this blog

SEO One On One - Web of Links

Protecting Personal Data

The Path is Already Mapped in Workspace