Solved

SQL syntax 'or'.

Posted on 2014-03-26
2
271 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard 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.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

772 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