Problem of Permissions for Linked Servers in .net page

S

savvy

I searching using Keywords in MS Word and pdf documents for which i
have used the Index Server and linked with SQL Server but when i am
running the stored procedure thro my webpage i'm getting these errors.
And when i run this code in Query Analyzer its giving expeceted
results. I dont know where the problem is can anyone help please . I'm
really badly stuck. Thanks in Advacne

User does not have permission to perform this action. Line 3: Incorrect
syntax near '@searchstring'. Invalid object name 'FileSearchResults'.
And my stored procedure is given below

CREATE PROCEDURE SelectIndexServerCVpaths
(
@searchstring varchar(100)
)
AS
Exec sp_addlinkedserver FileSystem,
'Index Server',
'MSIDXS',
'Web',
'c:\inetpub\wwwroot\sap-resources\Uploads'
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_NAME = 'FileSearchResults')
DROP VIEW FileSearchResults
EXEC ('CREATE VIEW FileSearchResults AS SELECT * FROM
OPENQUERY(FileSystem,''SELECT Directory, FileName,
DocAuthor, Size, Create, Write, Path FROM
SCOPE() WHERE FREETEXT(''@searchstring'')'')')
SELECT * FROM FileSearchResults F, CVdetails C WHERE C.CV_Path = F.PATH
AND C.DefaultID=1
GO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top