Hi Everybody I need some SQL expert Help to write a complex query( atleast for me) I am writing a procedure which will be passed a string which consist of value like (col1,value,col2,value,col3,value, and so on) What I need is that it should be changed to col1=value and col2=value and col3=value In addition, there are three rules Rule 1 ------- If col1 and col2 are same,[ only adjacent col can be same], then search string should be like Col1 in (value1,value2) Rule 2 ------ If col contain value like ABC% then search string for that col is COL3 LIKE ABC% Rule 3 ---------- if two adjacent col contains value AAAA and ABC%, then it should be transformed into (COL3 ='AAA' or COL3 like ABC%) Also any suggestion as how I can check if the value is number or String The String passed will be like Col1,111,Col2,AAAA,Col2,AB%,COL2,BBBB,Col3,23454,Col3,1212 Thanks Sanjay --------------------------------- Brings words and photos together (easily) with PhotoMail - it's free and works with Yahoo! Mail.