i have two rules(in fact many more, but i can put them in a cursor and execute one at a time) as below:
ID ConvertFrom ConvertTo Cond1_Type Cond1 Cond2_Type Cond2 Cond1_Position Cond2_Position
1 IN WDT wd that tag NNS 0 -1
2 IN WDT wd that tag VBZ 0 1
cond 1 or 2 position means the row number from the current row number
now i have a table
ItemID WordTokenPosition Word Tag
1 1 You PRP
1 2 received VBD
1 3 a DT
1 4 new JJ
1 5 voicemail NULL
2 1 The DT
2 2 info NULL
2 3 box NN
2 4 for IN
2 5 adding VBG
2 6 other JJ
2 7 accounts NNS
item id 1 or 2 denotes the sentence number in which the words have been parsed and then tagged. I want to go through the first mentioned 2 rules and re tag each word according to the conditions mentioned.
rule 1 (1 IN WDT wd that tag NNS 0 -1) is read as : if word is 'that' as position 0 ie same row and tag is NNS at position -1 ie previous row then convert tag from WDT to tag IN . the word and tag columns are present in the second table...
Trying to do something like this in SQL is one of those things that's theoretically possible, but insane. Cursors are there for the occasional iteration, and if you're asking about multiple cursors or complex stuff with cursors, it's a sure sign you should not be using SQL.
*If* you can learn LISP, that's your best shot. You can write stored procedures in any .NET language for SQL Server, and L# is a .NET version of LISP. Even if all you can handle is VB.net, that would be preferable to straight SQL.