Solved

SQL syntax 'or'.

Posted on 2014-03-26
2
274 Views
Last Modified: 2014-03-26
Is the syntax correct for the statement below? I am not sure of the multiple usage of the 'or'.  We are checking for the existance of all possible image files.

select top 1 @filename_to_import = line from _gpg_filenames where line like '%.jpg' or '%.jpeg’ or ‘%.jfif’ or ‘%.gif’ or ‘%.giff’ or ‘%.bmp’ or ‘%.png’ or ‘%.tiff’
0
Comment
Question by:tesla764
2 Comments
 
LVL 34

Accepted Solution

by:
johnsone earned 500 total points
ID: 39957379
You have to repeat the condition.

select top 1 @filename_to_import = line from _gpg_filenames where line like '%.jpg' or line like '%.jpeg’ or line like ‘%.jfif’ or line like ‘%.gif’ or line like ‘%.giff’ or line like ‘%.bmp’ or line like ‘%.png’ or line like ‘%.tiff’
0
 

Author Closing Comment

by:tesla764
ID: 39957394
Thanks.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL server 2014 replication error 35 46
AD and SQL Server 2016 2 31
HTML <font style="color:red"> 9 33
Reformat SQL - so SSRS can read the columns 25 14
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question