Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Wednesday, March 7, 2012

continue option in for loop

I have a for loop I have several tasks inside. I would like to "continue" with a new iteration if any of the tasks in the loop error or fail. Is this possible and if so -- how?

How about this:

Odd... the image shows up in the editor, but not in the message itself. Here is the URL: http://manowar.kicks-ass.org/images/matthew/blog/forloop-continue.jpg

This is basically a variation on the "script task as control flow placeholder" theme discussed here: http://bi-polar23.blogspot.com/2007/05/conditional-task-execution.html

Disclaimer: I have not fully tested this, but it should work. If not, it should give you a good starting point.

|||Thank you. I'll give this a try and send you a reply|||In doing testing, it appears that if a task within a for loop task fails, it immediately attempts to jump to the for loop container as its parent thereby acting as a 'continue' behavior. One item to note is that if continued looping is necessary in the event of a task failure, the MaxErrorCount value needs to be set to a value greater than 1. Otherwise the loop will fail altogether on the first child task failure.

Saturday, February 25, 2012

Contains with Var & WildCard

Inside of a stored proc, how would I issue a Contains using a variable and a
wild card, this dosent work
declare @.myvar varchar(50) -- this would be an imput param
set @.myvar = 'hello' -- this would be an imput param
select whatever
from CONTAINS(fieldname, ' " ' + @.myvar + ' *" ')
thanks!Try putting it seperately:
set @.myvar = '"' + @.myvar + '*" '
CONTAINS(fieldname, @.myvar )
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Don Schilling" <fake@.fake.com> schrieb im Newsbeitrag
news:OFlSiDQTFHA.548@.tk2msftngp13.phx.gbl...
> Inside of a stored proc, how would I issue a Contains using a variable and
> a
> wild card, this dosent work
> declare @.myvar varchar(50) -- this would be an imput param
> set @.myvar = 'hello' -- this would be an imput param
> select whatever
> from CONTAINS(fieldname, ' " ' + @.myvar + ' *" ')
> thanks!
>|||constains() only allows literals. so, you want to do the concatenation
outside of the function.
e.g.
@.newvar = quotename(@.myvar+'*','"')
...contains(col,@.newvar)
-oj
"Don Schilling" <fake@.fake.com> wrote in message
news:OFlSiDQTFHA.548@.tk2msftngp13.phx.gbl...
> Inside of a stored proc, how would I issue a Contains using a variable and
> a
> wild card, this dosent work
> declare @.myvar varchar(50) -- this would be an imput param
> set @.myvar = 'hello' -- this would be an imput param
> select whatever
> from CONTAINS(fieldname, ' " ' + @.myvar + ' *" ')
> thanks!
>|||Tried, no luck.
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:evruUQQTFHA.3012@.TK2MSFTNGP14.phx.gbl...
> Try putting it seperately:
> set @.myvar = '"' + @.myvar + '*" '
> CONTAINS(fieldname, @.myvar )
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "Don Schilling" <fake@.fake.com> schrieb im Newsbeitrag
> news:OFlSiDQTFHA.548@.tk2msftngp13.phx.gbl...
and
>|||Tried, dosent work.
"oj" <nospam_ojngo@.home.com> wrote in message
news:O6nKCXQTFHA.1896@.TK2MSFTNGP14.phx.gbl...
> constains() only allows literals. so, you want to do the concatenation
> outside of the function.
> e.g.
> @.newvar = quotename(@.myvar+'*','"')
> ...contains(col,@.newvar)
> --
> -oj
>
> "Don Schilling" <fake@.fake.com> wrote in message
> news:OFlSiDQTFHA.548@.tk2msftngp13.phx.gbl...
and
>

Friday, February 24, 2012

CONTAINS clause with multi-word "AND" inflectional searching?? help...

What if you want to search using FTS with AND logic using the FORMSOF(inflectional,...) inside the CONTAINS() clause?

if my search phrase is "light hearted" I can easily do an OR search using the following in my where clause:
CONTAINS(Colname,'formsof(INFLECTIONAL,light,heart ed).
but the and is far more tricky...

does anyone know how to do this without having multiple Contains statements (which greatly increases overhead)?

I know that I can use AND in a straight contains like so:
CONTANS(column, '"light" AND "hearted"') but this does not allow me to explore inflectional variations on the words...

nesting multiple FORMSOF's doesn't seem to work either like so:
contains(column,'"formsof(inflectional,light)"' AND 'formsof(inflectional,hearted)"')

anyone else found how to do this?just to clarify I think 2 better search words for my ex. would have been "sport" and "award" and it's really important that I get results for Sports, Sported, Awards, and Awarded. Then I'd have any combination of the two words Inflectional variations (one from each root word) that exist in the same record returned in my resultset.