Geeks With Blogs
AngelEyes on .Net Tips, tricks and WTFs about Asp .Net, SQL Server and the likes.
This is used to "use list as a table", i.e. take a list of comma-separated values, and run queries on it.
Credits due: look at the second post on http://searchvb.techtarget.com/tip/0,289483,sid8_gci932171,00.html
 
CREATE FUNCTION dbo.fnSplit(
@sInputList VARCHAR(8000) -- List of delimited items
, @sDelimiter VARCHAR(8000) = ',' -- delimiter that separates items
) RETURNS @List TABLE (item VARCHAR(8000))

BEGIN
DECLARE @sItem VARCHAR(8000)
WHILE CHARINDEX(@sDelimiter,@sInputList,0) <> 0
BEGIN
SELECT
@sItem=RTRIM(LTRIM(SUBSTRING(@sInputList,1,CHARINDEX(@sDelimiter,@sInputList,0)-1))),
@sInputList=RTRIM(LTRIM(SUBSTRING(@sInputList,CHARINDEX(@sDelimiter,@sInputList,0)+LEN(@sDelimiter),LEN(@sInputList))))

IF LEN(@sItem) > 0
INSERT INTO @List SELECT @sItem
END

IF LEN(@sInputList) > 0
INSERT INTO @List SELECT @sInputList -- Put the last item in
RETURN
END
GO
--Test
select * from fnSplit('1,22,333,444,,5555,666', ',')
select * from fnSplit('1##22#333##444','##') --note second item has embedded #
select * from fnSplit('1 22 333 444 5555 666', ' ')
Posted on Thursday, April 12, 2007 6:54 AM | Back to top


Comments on this post: SQL Server split function

# re: SQL Server split function
Requesting Gravatar...
Thanks, this is very useful.
/Daniel
Left by Daniel on Jan 16, 2008 4:15 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks, Daniel.
Left by Angel Eyes on Jan 16, 2008 4:32 PM

# re: SQL Server split function
Requesting Gravatar...
thanks

Left by bylove on May 07, 2008 10:48 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks a lot
Left by Rachana on Jun 13, 2008 9:14 AM

# re: SQL Server split function
Requesting Gravatar...
Thanks a lot. Its very useful.
Left by falguni on Jul 15, 2008 8:46 PM

# to falguni
Requesting Gravatar...
Glad to have helped :-)
Left by angel eyes on Jul 15, 2008 8:59 PM

# re: SQL Server split function
Requesting Gravatar...
Sure thing.
Left by angel eyes on Jul 26, 2008 10:04 AM

# re: SQL Server split function
Requesting Gravatar...
This is great! :)

If I then want to get back only the nth row from the resulting table how would I get it? I would presume there is some sort of rownum function that we can use?
Left by Andrew McGimpsey on Jul 29, 2008 2:47 PM

# re: get back only the nth row from the resulting table
Requesting Gravatar...
Assuming you want to keep the resulting table, you can add RowNumber(), like this:
select ROW_NUMBER() over (order by item) as RowNum, * from fnSplit('1,22,333,444,,5555,666', ',')

And then get the 4th row like this:
select * from
(select ROW_NUMBER() over (order by item) as RowNum, * from fnSplit('1,22,333,444,,5555,666', ',')) tt
where RowNum = 4
Left by angel eyes on Jul 29, 2008 5:16 PM

# re: SQL Server split function
Requesting Gravatar...
Good f(x)
Left by gsd on Aug 01, 2008 6:51 AM

# re: SQL Server split function
Requesting Gravatar...
Hi
I was write this sp :

UPDATE TBLMessages
SET Location = @Location, FolderID = @FolderID
WHERE (dbo.TBLMessages.MsgID in (SELECT item FROM dbo.FnSplit(MsgID,',')))

But It Updates All Records !!!
Left by Ali on Sep 17, 2008 7:37 AM

# re: Ali
Requesting Gravatar...
Ali, your query doesn't make much sense. what were you trying to do, and what does the MsgID field contain?
Left by angel eyes on Sep 17, 2008 9:03 AM

# re: SQL Server split function
Requesting Gravatar...
If I were trying to use this to split a column that I select, how would I do that?

For example, say we have some customer numbers that are set up in a special fashion like 000-xxx-xxx, and others that are set up like normal numbers areacode-prefix-number, and I want to throw that into a case when and pull a list of how many users we have set up like that, kind of like this:

SELECT SUM(CASE WHEN (SELECT item FROM (SELECT ROW_NUMBER() OVER (ORDER BY item) AS RowNum, * FROM fnSplit(SELECT dbo.CUSTOMER.PHONE_NUM FROM dbo.CUSTOMER WHERE CUSTOMER.CUST_ID=1234, '-')) drvTbl WHERE RowNum = 1) THEN 1 ELSE 0 END) AS IRREGULAR_COUNT FROM dbo.CUSTOMER

The fnSplit function doesn't allow me to throw a select statement in it (or maybe I'm just missing something here).

Any ideas?
Left by Matt on Sep 26, 2008 6:55 PM

# re: SQL Server split function
Requesting Gravatar...
Yea, I figured that out after banging my head against the wall for an hour or so. I have a tendancy to overthink things sometimes, haha.

Thanks for the reply, and the great blog.
Left by Matt on Sep 30, 2008 12:59 AM

# re: SQL Server split function
Requesting Gravatar...
Is there a way to use fnsplit on a column that is selected?

For example:
select * from dbo.fnsplit(select prov_title from provider where prov_title > ' ')

This doesn't work.
Left by Marcie on Oct 15, 2008 4:12 PM

# Marcie
Requesting Gravatar...
Hey Marcie.
To my knowledge, you cannot use the function like that, in a query.
You can use a cursor to do the same thing, but of course you'll have to watch the performance.
Left by angel eyes on Oct 15, 2008 8:24 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks!
It's very useful to me.

Left by fatty0860 on Nov 11, 2008 9:33 AM

# re: SQL Server split function
Requesting Gravatar...
Thanks a Lot.
Left by Baljeet Singh on Dec 29, 2008 11:52 AM

# To: fatty0860 and Baljeet Singh
Requesting Gravatar...
Sure, glad to be of help.
Left by Angel Eyes on Dec 29, 2008 8:17 PM

# re: SQL Server split function
Requesting Gravatar...
Hello,

how can I use this function with a cursor?

I want to use this function like this example:
select * from dbo.fnsplit(select prov_title from provider where prov_title > ' ')
Left by Devil on Mar 05, 2009 4:01 PM

# re: club penguin
Requesting Gravatar...
Thanks, Club Penguin, it means a lot!
Left by Angel Eyes on Mar 26, 2009 12:15 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks!
It's very useful to me.
Left by porno izle on Mar 26, 2009 1:41 PM

# Turkey Tourism
Requesting Gravatar...
Thanks for writing.but please letters be more big.:)
Left by tourist book on Mar 26, 2009 4:28 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks you
Left by Diyarbakir on Mar 26, 2009 6:04 PM

# re: SQL Server split function
Requesting Gravatar...
thanks you
Left by pornoizle on Mar 26, 2009 6:20 PM

# re: SQL Server split function
Requesting Gravatar...
Thank you very useful information.
Left by oyun indir on Mar 26, 2009 7:23 PM

# re: SQL Server split function
Requesting Gravatar...
thanks a lot..
Left by türk porno izle on Mar 26, 2009 7:58 PM

# re: SQL Server split function
Requesting Gravatar...
Very thanks.
Left by ali veli on Mar 26, 2009 9:07 PM

# re: SQL Server split function
Requesting Gravatar...
Very nice, thanks.....
Left by Downloadic on Mar 26, 2009 9:29 PM

# re: SQL Server split function
Requesting Gravatar...
Hı :) Thank you post...

SMF Destek

Left by SMF Destek on Mar 26, 2009 10:25 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks for articles.
Left by Porno Sikiş on Mar 26, 2009 10:31 PM

# re: SQL Server split function
Requesting Gravatar...
Sorry my english firstly, i read well but i cant write :), So its useful post for me and i bookmarked your blog.

wordpress themes

web tasarım
Left by free wordpress themes on Mar 26, 2009 10:56 PM

# re: tourist book
Requesting Gravatar...
I'll change the fonts, or the whole theme :-)
Left by Angel Eyes on Mar 27, 2009 12:16 PM

# re: SQL Server split function
Requesting Gravatar...
Thank you for information.
Left by worldmp3 on Mar 27, 2009 1:59 PM

# re: SQL Server split function
Requesting Gravatar...
useful article, many thanks.


Daily Linux News
web hosting
Left by Sezer DEGE on Mar 28, 2009 12:19 PM

# re: SQL Server split function
Requesting Gravatar...
i have modified to return item at specified index:

ALTER FUNCTION [dbo].[split](@sInputList VARCHAR(8000),@sDelimiter VARCHAR(8000) = ',',@Index INT)
RETURNS NVARCHAR(4000)
BEGIN
DECLARE @sItem VARCHAR(8000)
DECLARE @retval NVARCHAR(4000)
DECLARE @tempIndex INT
DECLARE @List TABLE(item VARCHAR(8000))
SET @tempIndex = 0
WHILE Charindex(@sDelimiter,@sInputList,0) <> 0
BEGIN
SELECT @sItem = Rtrim(Ltrim(Substring(@sInputList,1,Charindex(@sDelimiter,@sInputList,0) - 1))),
@sInputList = Rtrim(Ltrim(Substring(@sInputList,Charindex(@sDelimiter,@sInputList,0) + Len(@sDelimiter),
Len(@sInputList))))
IF Len(@sItem) > 0
INSERT INTO @List
SELECT @sItem
IF (@tempIndex = @Index)
SET @retval = @sItem
SET @tempIndex = @tempIndex + 1
END
IF Len(@sInputList) > 0
INSERT INTO @List
SELECT @sInputList -- Put the last item in
IF (@tempIndex = @Index)
SET @retval = @sItem
RETURN @retval
END
GO
Left by francisco on Apr 10, 2009 12:23 AM

# re: SQL Server split function
Requesting Gravatar...
Way to go, Fransisco, Thanks for letting us know about it!
Left by re: francisco on Apr 10, 2009 11:09 AM

# re: SQL Server split function
Requesting Gravatar...
This doesn't work if space is your actual separator. ie there should be a NULL item, ala the first test, in the third test. As written extra spaces are discarded.
Left by Tobar on Apr 22, 2009 6:46 PM

# re: SQL Server split function
Requesting Gravatar...
By "this" I was referring to the original post.

Here is a fix. Why in the world MS thought it smart to not count a space in the len() function is beyond me.

drop function dbo.fnSplit

go

CREATE FUNCTION dbo.fnSplit(
@sInputList VARCHAR(8000) -- List of delimited items
, @sDelimiter VARCHAR(8000) = ',' -- delimiter that separates items
) RETURNS @List TABLE (item VARCHAR(8000))

BEGIN
DECLARE @sItem VARCHAR(8000)
WHILE CHARINDEX(@sDelimiter,@sInputList,0) <> 0
BEGIN
SELECT
@sItem=SUBSTRING(@sInputList,1,CHARINDEX(@sDelimiter,@sInputList,0)-1),
@sInputList=SUBSTRING(@sInputList,CHARINDEX(@sDelimiter,@sInputList,0)+DATALENGTH(@sDelimiter),DATALENGTH(@sInputList))

IF LEN(@sItem) > 0
INSERT INTO @List SELECT @sItem
ELSE IF LEN(@sItem) = 0
INSERT INTO @List SELECT NULL
END

IF LEN(@sInputList) > 0
INSERT INTO @List SELECT @sInputList -- Put the last item in
RETURN
END
GO
--Test
select * from fnSplit('1,22,333,444,,5555,666', ',')
select * from fnSplit('1##22#333##444','##') --note second item has embedded #
select * from fnSplit('1 22 333 444 5555 666', ' ')
Left by Tobar on Apr 22, 2009 8:55 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks ,for articles.
Left by Ali on May 08, 2009 6:44 PM

# EMİRCAN OTO KİRALAMA ANKARA
Requesting Gravatar...
Thank you

Left by Cihan on Jun 22, 2009 8:34 AM

# LÜKS OTO KİRALAMA ANKARA EMİRCAN
Requesting Gravatar...
mersi şekerim
Left by Ciko on Jun 22, 2009 8:39 AM

# re: SQL Server split function
Requesting Gravatar...
Nice work. Was just about to write this myself then thought I should see if somebody else had already posted a solution before I reinvented the wheel. Now that's the proper meaning of resuable code.
Left by Sunshine Coast Web Designer on Jul 08, 2009 7:21 AM

# re: SQL Server split function
Requesting Gravatar...
thanks admins very nicess
Left by güncel blog on Jul 08, 2009 2:25 PM

# re: SQL Server split function
Requesting Gravatar...
thanks you goods
Left by video seyret on Jul 08, 2009 2:27 PM

# re: SQL Server split function
Requesting Gravatar...
Good on your
Left by Lida on Jul 18, 2009 9:52 AM

# re: SQL Server split function
Requesting Gravatar...
THanks a lot
Left by Lida on Jul 18, 2009 9:54 AM

# re: SQL Server split function
Requesting Gravatar...
Lot name a
Left by Lida on Jul 18, 2009 9:54 AM

# prefabrik fiyatları
Requesting Gravatar...
Thanks for the reply, and the great blog.
Left by prefabrik fiyatlari on Aug 07, 2009 12:35 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks for the reply, and the great blog.
Left by Diyarbakir on Aug 12, 2009 10:10 PM

# re: SQL Server split function
Requesting Gravatar...
Good on your
Left by Urls on Aug 12, 2009 10:10 PM

# re: SQL Server split function
Requesting Gravatar...
very useful command.thanks for that
Left by evden eve nakliyat on Sep 09, 2009 12:17 PM

# re: SQL Server split function
Requesting Gravatar...
THanks a lot
Left by invention of lying online on Oct 05, 2009 2:34 PM

# re: SQL Server split function
Requesting Gravatar...
thanks admins very nicess
Left by Forum on Nov 15, 2009 8:32 PM

# re: SQL Server split function
Requesting Gravatar...
It's very help full to me thanks
Left by Sunil Kumar Sharma on Dec 24, 2009 10:56 AM

# re: SQL Server split function
Requesting Gravatar...
very nice htanks
Left by koçluk on Dec 30, 2009 1:53 PM

# re: SQL Server split function
Requesting Gravatar...
Well worth the read. Thanks for sharing this information. I got a chance to know about this.
Left by Clasamente Fotbal on Jan 23, 2010 2:18 PM

# re: SQL Server split function
Requesting Gravatar...
love you
Left by usama on Feb 20, 2010 9:18 AM

# re: SQL Server split function
Requesting Gravatar...
thanks adminss good very nicess
Left by adult videolar on Feb 28, 2010 12:49 PM

# re: SQL Server split function
Requesting Gravatar...
hi its very useful but how can i use the split function to search a full name with 3 type of names(first,middle,last) name?

Plz its urgent Reply needed
Left by SSdevi on Mar 19, 2010 10:36 AM

# re: SSdevi
Requesting Gravatar...
I'm sorry, I didn't understand your question.
Left by Angel Eyes on Mar 19, 2010 12:17 PM

# re:SQL Server split function
Requesting Gravatar...
thanks adminss good very nicess
Left by evden eve nakliyat on May 23, 2010 3:12 AM

# esya
Requesting Gravatar...
The first priority of the site administrator for your comments right know, thank you. Really very good information-sharing gives you.
Thanks in knowledge
Left by chris on May 23, 2010 3:19 PM

# re: SQL Server split function
Requesting Gravatar...
thanks for this article
Left by Meksika biberi zayıflama hapı on Jun 01, 2010 3:01 PM

# re: SQL Server split function
Requesting Gravatar...
It is good that you share this informations whit us.
Left by rca ieftin 2011 on Jun 22, 2010 7:04 PM

# re: SQL Server split function
Requesting Gravatar...
thank you man
Left by web tasarım on Aug 04, 2010 1:45 PM

# re: SQL Server split function
Requesting Gravatar...
thanks for this article .
Left by ucuz web tasarım on Aug 16, 2010 2:30 AM

# re: SQL Server split function
Requesting Gravatar...
Sending interactive content (changeable text, changeable images, forms, etc) to other users, websites and other applications. Like: if i want
Left by prefabricated on Aug 26, 2010 3:35 PM

# re: SQL Server split function
Requesting Gravatar...
thanks for this article .
Left by havuz on Sep 14, 2010 11:45 AM

# re: SQL Server split function
Requesting Gravatar...
thanks very much for sharing
Left by peruk on Sep 14, 2010 11:49 AM

# re: SQL Server split function
Requesting Gravatar...
thanks very much
Left by Fenerbahçe Beşiktaş Maçını İzle on Sep 14, 2010 12:21 PM

# re: SQL Server split function
Requesting Gravatar...
thank you best regards. Goods rapids.
Left by Resim Paylas on Sep 16, 2010 2:53 AM

# re: SQL Server split function
Requesting Gravatar...
great, thanks.
Left by sa on Oct 05, 2010 2:01 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks for article. Everytime watch blog like to read you
Left by php görsel eğitim on Oct 06, 2010 9:35 PM

# çocuk montu
Requesting Gravatar...
thank you best regards. Goods rapids.
Left by zafer on Oct 14, 2010 12:23 PM

# çocukmont
Requesting Gravatar...
thanks very much by man
Left by zafer on Oct 14, 2010 5:29 PM

# re: SQL Server split function
Requesting Gravatar...
very good! thanks..
Left by fotoğrafçı on Oct 20, 2010 1:40 PM

# re: SQL Server split function
Requesting Gravatar...
well done man. very good sharing..
Left by havuz on Oct 21, 2010 9:37 AM

# re: SQL Server split function
Requesting Gravatar...
thank you. very interesting
Left by peruk on Oct 21, 2010 9:38 AM

# re: SQL Server split function
Requesting Gravatar...
very well. thanks man
Left by toptan takım elbise on Oct 22, 2010 9:20 PM

# re: SQL Server split function
Requesting Gravatar...
Super ...
Left by Suresh on Oct 27, 2010 9:33 AM

# re: SQL Server split function
Requesting Gravatar...
Thank you admin good article
Left by web tasarım on Oct 28, 2010 9:04 PM

# ozaygroup
Requesting Gravatar...
verytime watch blog like to read you
Left by toptan takım elbise on Nov 07, 2010 5:35 PM

# elestirel haber
Requesting Gravatar...
Thanks for article.
Left by maç özeti ve golleri on Nov 07, 2010 5:37 PM

# re: SQL Server split function
Requesting Gravatar...
It would be great if I could just say "movie Batman" and it would search Batman on IMDB, or "google firefox" and etc. In fact, my Eee PC has this functionality, so it stands to reason that Firefox could to. Anyway, those are just some of my thoughts off the top of my head. I'm sure that with some more thought a really well-built voice command extension could be built.

http://www.karmod.eu
Left by prefabricated on Nov 12, 2010 9:50 AM

# re: SQL Server split function
Requesting Gravatar...
Thanks... I found it really useful
Left by Rinkal on Nov 19, 2010 11:52 AM

# re: SQL Server split function
Requesting Gravatar...

I'm afraid it's all a fraud. Unfortunately, almost a decade only everything revolves around money. People who until recently had an enviable character fall prey to these temptations. Unfortunately, society as a whole began to decline and only fault I see greed. We humans would be to think that there are many other things more important than money. And maybe we will be able to change something in our thinking.
Left by auto hibride on Dec 01, 2010 1:03 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks Admin ,for articles.
Left by Memocix on Dec 11, 2010 2:50 PM

# Business Letters
Requesting Gravatar...
As a business owner and sales professionals, I am sure we share many of the same problems. I am always have to write letters. I have to write a follow up letter, sales letter, thank you letter, welcome letter, and other legal and professional letters.

I have found a great Letter Template Tool that i would like to share with all business owners and Sales agents, reps, and professionals...

It has helped me save time and money...Check it out, and give it a try...
Left by Sales Letters Template on Dec 13, 2010 4:50 AM

# re: SQL Server split function
Requesting Gravatar...
Greate article, congratulations !
Left by Cel mai ieftin RCA on Dec 17, 2010 11:10 AM

# re: SQL Server split function
Requesting Gravatar...
clean and crisp solution..
http://www.a2zmenu.com/MySql/SQL-Split-Function.aspx
Left by experts comment on Dec 19, 2010 11:59 AM

# re: SQL Server split function
Requesting Gravatar...
expression was very nice thank you Waiting for More
Left by forex on Dec 20, 2010 2:49 PM

# re: SQL Server split function
Requesting Gravatar...
Unfortunately, society as a whole began to decline and only fault I see greed.
Left by çilingir on Dec 31, 2010 2:59 PM

# re: SQL Server split function
Requesting Gravatar...
thanks for blogg..
Left by resimler on Jan 10, 2011 2:52 AM

# re: SQL Server split function
Requesting Gravatar...
nice good job.
Left by web tasarım on Jan 11, 2011 6:20 PM

# re: SQL Server split function
Requesting Gravatar...
thank you very much
Left by fotoğraf çekimi on Jan 18, 2011 11:41 AM

# re: SQL Server split function
Requesting Gravatar...
Gravatar
Thanks a lot
Left by samsun on Jan 23, 2011 1:03 PM

# re: SQL Server split function
Requesting Gravatar...
Thank you admin good article. Good job

web tasarım
Left by web tasarımı on Jan 28, 2011 9:52 AM

# re: SQL Server split function
Requesting Gravatar...
Thank you admin good article. Good job

http://www.celilcan.com
Left by web tasarımı on Jan 28, 2011 9:53 AM

# re: SQL Server split function
Requesting Gravatar...
Thank you admin
Left by Webmaster Blog on Jan 28, 2011 9:56 AM

# re: SQL Server split function
Requesting Gravatar...
Thank you admin good article. Good job
Left by umre kayıtları on Jan 29, 2011 8:22 PM

# re: SQL Server split function
Requesting Gravatar...
More Waiting for you to continually write articles I am following a very successfull
Left by gelinlikler on Feb 01, 2011 5:44 PM

# re: SQL Server split function
Requesting Gravatar...
FYI:
If you use cross / outer apply you can join it to a table row by row without a cursor

http://www.mssqltips.com/tip.asp?tip=1958

select * from CF1 cf cross apply fnSplit(value_text,'$,$')
where value_text like '%$,$%'
Left by Ed on Feb 02, 2011 11:16 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks you very much! Wonderful comments, i am reading this blog and very happy now!

Thanks again!

Left by çiçek sipasi gönder on Feb 07, 2011 12:45 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks!
It's very useful to me.
Left by sanalcadı on Feb 08, 2011 4:46 PM

# re: SQL Server split function
Requesting Gravatar...
As someone who is learning about SQL Server, the code listed is useful.
Left by mini fridge on Feb 09, 2011 1:10 AM

# re: SQL Server split function
Requesting Gravatar...
thank you for sharing post
Left by web tasarım ankara on Feb 11, 2011 11:55 PM

# re: SQL Server split function
Requesting Gravatar...
otel, otel rehberi, otel fiyatları, bayilikler, ucuz otel, tatil, tatil yerleri, konaklama, otel rezervasyon, afton otel, erzurum otel, sivas otal, oteller, otel turları, otel ajansları, istanbul oteller, türkiye oteller, rezervasyon, giriş işlemleri, otel rehberleri, anlaşmalı oteller, otel rehberi
Left by mermer lavabo on Feb 12, 2011 11:42 AM

# re: SQL Server split function
Requesting Gravatar...
thank you nice post tercüme hizmetleri
Left by tercüme on Feb 16, 2011 6:15 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks for the given informations. These are really good and very useful informations. Everybody has to see that. So I will share this link with all my friends. Thanks
Left by kocluk-egitimi on Feb 17, 2011 1:40 PM

# re: SQL Server split function
Requesting Gravatar...
When human life is indispensable to the settlement with the location of developing practical solutions, has left the right. Housing at the beginning of creating practical solutions that are ready-mixed concrete. Ready Mixed Concrete our time sine qua non of the construction sector.
Left by hazır beton on Feb 17, 2011 5:53 PM

# re: SQL Server split function
Requesting Gravatar...
Fotograf sanatçısı Sami Aker İstanbul da Modacı Fransız bir anneden doğdu ve şehrin moda merkezi nişantaşında yetişti, ilk orta ve liseyi Şişli Terakki Lisesinde tamamladıktan sonra İstanbul Üniversitesinden ve Marmara Universitesinden pazarlama ve image konusunda master derecesi ile mezun oldu.
Left by fotoğraf çekimi on Feb 17, 2011 5:55 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks for the given informations. These are really good and very useful informations. Everybody has to see that. So I will share this link with all my friends. Thanks
Left by otobüs firmaları on Feb 19, 2011 4:22 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks you very much! Wonderful comments, i am reading this blog and very happy now!
Left by peruk on Feb 19, 2011 4:24 PM

# re: SQL Server split function
Requesting Gravatar...
A great article written with great hard work...i must say....Thanks for posting this article. I am definitely tired of struggling to find relevant and intelligent commentary on this subject. Everyone nowadays seem to go to extremes to either drive home their viewpoint or suggest that everybody else in the globe is wrong. Thanks for your concise and relevant insight a great work of your which shows...
Left by cheap replica watches on Feb 21, 2011 11:57 AM

# re: SQL Server split function
Requesting Gravatar...
I just love your blog.Thanks for posting it.i have something that someone comeback again….there is a lot of useful information a person can get from here…I must say,well done...i visited it daily,what a colourful blog it is....colours attracted me a lot....i visited it daily,what a colourful blog it is.... a very decent and nice blog...i like it so very much...
Left by Go Seeq Search Engine on Feb 21, 2011 11:58 AM

# re: SQL Server split function
Requesting Gravatar...
thanks for sharing...
Left by web tasarım ankara on Feb 23, 2011 1:49 PM

# re: SQL Server split function
Requesting Gravatar...
Thanks for article. Everytime watch blog like to read youİzmir reiki<br />
Left by izmir-reiki on Feb 25, 2011 6:22 PM

# re: SQL Server split function
Requesting Gravatar...
If I were trying to use this to split a column that I select, how would I do that?

For example, say we have some customer numbers that are set up in a special fashion like 000-xxx-xxx, and others that are set up like normal numbers areacode-prefix-number, and I want to throw that into a case when and pull a list of how many users we have set up like that, kind of like this:

SELECT SUM(CASE WHEN (SELECT item FROM (SELECT ROW_NUMBER() OVER (ORDER BY item) AS RowNum, * FROM fnSplit(SELECT dbo.CUSTOMER.PHONE_NUM FROM dbo.CUSTOMER WHERE CUSTOMER.CUST_ID=1234, '-')) drvTbl WHERE RowNum = 1) THEN 1 ELSE 0 END) AS IRREGULAR_COUNT FROM dbo.CUSTOMER

The fnSplit function doesn't allow me to throw a select statement in it (or maybe I'm just missing something here).

Any ideas? İzmir kişisel gelişim merkezi
Left by izmir-kisisel-gelisim-merkezi on Feb 25, 2011 6:26 PM

# re: SQL Server split function
Requesting Gravatar...
This is great! :)

If I then want to get back only the nth row from the resulting table how would I get it? I would presume there is some sort of rownum function that we can use? İzmir öğrenci koçluğu
Left by izmir-öğrenci-koçluğu on Feb 25, 2011 6:29 PM

# re: SQL Server split function
Requesting Gravatar...
thanks very nicess good code
Left by ev mobilya on Mar 06, 2011 8:27 PM

# re: SQL Server split function
Requesting Gravatar...
thanks adminss good
Left by hair styles on Mar 10, 2011 9:34 PM

# re: SQL Server split function
Requesting Gravatar...
I want to throw that into a case when and pull a list of how many users we have set up like that, kind of like this:
Left by devlet hastane on Mar 12, 2011 10:54 AM

# re: SQL Server split function
Requesting Gravatar...
Thank you. great working
Left by Fx15 on Mar 12, 2011 11:51 AM

Comments have been closed on this topic.
Copyright © AngelEyes | Powered by: GeeksWithBlogs.net | Join free