Guest_imported
New member
- Jan 1, 1970
- 0
Hi all I hope someone can help me.
I have a stored procedure that inserts data into multiple tables. I am wanting to parse a comma delimited string and insert new records for each element. i.e
@year1content = french,german,maths,ecnomics...
(from textarea form field)
@CourseID = @@IDENTITY (from autonumber in main table)
---------------------------------------------------------
SET @CourseID = @@IDENTITY
--insert into year1 Table
INSERT INTO Year1 (CourseID, Content)
VALUES (@CourseID, @year1content) -- I need a loop here?
Return
-------------------------------------
To give me:
Year1
-------------------
ID Content
------------------
2 french
2 german
2 maths
2 economics
Thanks in Advance.
I have a stored procedure that inserts data into multiple tables. I am wanting to parse a comma delimited string and insert new records for each element. i.e
@year1content = french,german,maths,ecnomics...
(from textarea form field)
@CourseID = @@IDENTITY (from autonumber in main table)
---------------------------------------------------------
SET @CourseID = @@IDENTITY
--insert into year1 Table
INSERT INTO Year1 (CourseID, Content)
VALUES (@CourseID, @year1content) -- I need a loop here?
Return
-------------------------------------
To give me:
Year1
-------------------
ID Content
------------------
2 french
2 german
2 maths
2 economics
Thanks in Advance.