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
 General SQL Server Forums
 New to SQL Server Programming
 Help with the WHERE query

Author  Topic 

amjad171
Starting Member

15 Posts

Posted - 2011-01-06 : 09:36:42
Hello,
I am new to this and any help is greatly appreciated:

I have a WHERE query:

SELECT Path, Title, MD5Hash FROM tbSA_ImportFile WHERE (Path LIKE '\subjects\geog')

What I want it to do is to return all the records in the Path column that begin with "\subjects\geog"

Can anyone help?

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2011-01-06 : 10:02:38
is this ?
SELECT Path, Title, MD5Hash FROM tbSA_ImportFile WHERE Path LIKE '\subjects\geog%'

I am here to learn from Masters and help new bees in learning.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-01-06 : 10:07:15
For slightly tighter and narrower criteria you might want:

SELECT Path, Title, MD5Hash FROM tbSA_ImportFile WHERE Path LIKE '\subjects\geog\%'
Go to Top of Page

amjad171
Starting Member

15 Posts

Posted - 2011-01-06 : 10:17:29
many thanks guys,

this has worked. The only issue i'm having now is that using Visual Studio 2010, when I set up a SQL DataSource to connect to the DB and then a DataList to display the records, in the DataSource coneection in the Query analyser the correct results are being returned, however when I check the DataList on the broswer it still diplays all the records not just the ones for /subjects/geog

any ideas why this is?

thank you again
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-08 : 01:36:32
are you sure you're using correct datasource to linked to data list?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -