Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Filter records

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2008-02-13 : 21:37:28
Hello,

I have a table to hold files information.
One of the table columns is Path which holds values as:

C:\Assets\MyPic.jpg
C:\Assets\MyCV.doc
...

I need to get all record which are images, i.e., which extension is .jpg, .gif, .png.

How can I do this?

Should I create, instead, a column named type and before I insert a record I would detect in my C# code the file type and fill the Type column with it?

Thank You,
Miguel

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2008-02-13 : 22:43:05
Select * From <Table> Where Right(<Field>, 3) In ('jpg', 'gif', 'png')


Thanks,

Mahesh
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2008-02-14 : 07:46:11
Thanks!
Go to Top of Page
   

- Advertisement -