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:
01324011
Views:
11
Use LIKE
	IF @Filename LIKE '%.doc%'
>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
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform