Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 INSERT INTO semicolon separated

Author  Topic 

Johnyalm
Starting Member

49 Posts

Posted - 2006-01-14 : 11:25:02
I would like to insert a string value consisting of a series of email addresses into a temporary table but get each email address into a separate row!

Here is an example:

SET NOCOUNT ON

CREATE TABLE #Tjosan
( rank int IDENTITY (1, 1),
email varchar(1024) )

INSERT INTO #Tjosan
(email)
VALUES ('emai1@email1.com;email2@email2.com;email3@email3.com;email4@email4.com')

SELECT * FROM #Tjosan ORDER BY email

DROP TABLE #Tjosan
SET NOCOUNT OFF
------------------------------

I cannot handle the string in my application so I would like to get the query to handle the problem and insert each email address into a new row for each email!

www.mirrorgate.com

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-01-14 : 12:05:36
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -