You are here: trigger to parse a string from insert statement « MsSQL Server « IT news, forums, messages
trigger to parse a string from insert statement

Posted by uspensky on 03/22/06 02:37

I have two tables:

tb_news--
-story_id
-productlist

tb_lookup--
-story_id
-product

when an insert command is run on tb_news, productlist field is
populated with a value such as 'abc, def, de'

when this happens, i need tb_lookup to be populated with seperate
records for each product in productlist and the story_id from tb_news.

Example:
INSERT INTO tb_news (story_id, product_list)
VALUES (12345, 'abc, def, de')

Results:
tb_news--
12345, 'abc, def, de'

tb_lookup--
12345, 'abc'
12345, 'def'
12345, 'de'


Ideally, I would like this to use recursion and give me tha ability to
change the delimiter at any time (might not always be a comma). some
products may have a period in them. number of products is unknown and
might be 0 (field may be empty or NULL).

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация