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)
 Query get all records which has path extension pdf

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2008-09-11 : 10:49:44
How to get all the rows which has the extension pdf end the end of filepath.

filepath is the field it has the filepath stored in it: name: 'D:\ProjectImages\HRT\RM\projectFileName.pdf'

*****************************
select docid, filepath from table_files where filepath extension has .pdf.
**************************

Thank you very much for the information.

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2008-09-11 : 10:51:56
select docid, filepath from table_files where right(filepath,4) = '.pdf'

Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2008-09-11 : 10:53:09
Thks a lot.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-09-11 : 19:04:13
I'm not sure if applying the RIGHT function is any slower than a LIKE comparison, but you could also try:
select docid, filepath from table_files where filepath LIKE '%.pdf'
Go to Top of Page
   

- Advertisement -