Problem with comparing a Table View Column with the Table Column?  
Author Message
VSAT





PostPosted: Wed Jan 18 09:03:49 CST 2006 Top

SQL Server Developer >> Problem with comparing a Table View Column with the Table Column?

I have a CVdetails table which all the personal and technical details
along with the path called CV_Path which stores the path of CV word
doc. Using Index Server Query i got the paths in my SQL server using
Linked Server. I used this Query

SELECT Path FROM OPENQUERY (FileSystem,'SELECT Directory, FileName,
DocAuthor, Size, Create, Write, Path FROM SCOPE (''
"c:\myCatalogFolder" '') WHERE FREETEXT (''reference'')')

Which gave a result:
Path
c:\mycatalogfolder\ajaxguide.doc
c:\mycatalogfolder\quickguide.txt

Now, I want to compare these paths with the ones in the CVdetails
table which are same and drag out the relevant CVdetails of that
particular path. My code is shown below but its not working out, its
not giving any results though the paths are same. I hope I made some
sense till now

Thanks in Advance

IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_NAME = 'FileSearchResults')
DROP VIEW FileSearchResults
GO
CREATE VIEW FileSearchResults
AS
SELECT * FROM OPENQUERY (FileSystem,'SELECT Directory, FileName,
DocAuthor, Size, Create, Write, Path FROM SCOPE (''
"c:\myCatalogFolder" '') WHERE FREETEXT (''reference'')')
Go
SELECT * FROM FileSearchResults F, CVdetails C WHERE C.CV_Path = F.PATH

Go

SQL Server242  
 
 
savvy





PostPosted: Wed Jan 18 09:03:49 CST 2006 Top

SQL Server Developer >> Problem with comparing a Table View Column with the Table Column? i think i got the answer. Just now i found out that though i assign the
path directly as shown below it was not selecting the particular row.
I checked be4 therefore no spaces i dont know why it was not selecting
SELECT * FROM CVdetails WHERE
CV_Path='c:\mycatalogfolder\quickguide.txt'
Then i deleted the path in that field and copied it again and suprising
it worked.
Anyway, it worked finally