It would help if you supplied the DDL for your database table, as well as a full working example of what you're trying to do. You can use code BB tags to put in the code here. (http://www.bbcode.org/examples/?id=15)
Moved to Scripts/3rd Party Applications