Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IF variable contains string
Message
 
To
13/06/2008 17:20:43
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01324006
Message ID:
01324010
Views:
12
>This is part of script. I want to only run the code if the @Filename contains the string ".doc" but I'm getting an error on the syntax.
>
>
>Msg 102, Level 15, State 1, Line 133
>Incorrect syntax near '@Filename'.
>
>			IF  CONTAINS(@Filename, '.doc')
>				Set @CONVERTSCRIPT = 'c:\Tiff\RTFConverter.exe "' + @DocumentID + '|c:\ImpactMD\Export\' + @DocumentID + '.rtf"'
>				Print 'Convert Script - ' + @CONVERTSCRIPT
>				exec master.dbo.xp_cmdshell @CONVERTSCRIPT, no_output
>
Try with:
IF CHARINEX('.doc', @Filename) > -
    ..
From BOL:
Is a predicate used to search columns containing character-based...
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform