Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS that executes query at run-time..

Status
Not open for further replies.

diddydustin

Programmer
Jul 30, 2002
181
US
Hey guys,

I need to create a DTS that accepts a strQuery as user input, compares it exclusively with another query, then return what is left. Once the results are back, I need it to insert this into a table.

Of course I would also need to validate the user input query.

I'm having some trouble with this-- here's what I got so far:

INSERT INTO tblQueItem (intQueID, chrISBN)
((EXEC (@strQuery))
EXCEPT
(SELECT intQueID, chrISBN
FROM vwReportQue
WHERE intQueID = @intQueID))

which returns:
Server: Msg 156, Level 15, State 1, Procedure spExec_tblQuery, Line 16
Incorrect syntax near the keyword 'EXEC'.
Server: Msg 170, Level 15, State 1, Procedure spExec_tblQuery, Line 16
Line 16: Incorrect syntax near ')'.
Server: Msg 170, Level 15, State 1, Procedure spExec_tblQuery, Line 20
Line 20: Incorrect syntax near ')'.

I've also tried Execute sp_executesql and sp_execute but get the same error.

Of course the code above is not validating anything yet.

Any help would be appreciated!
Thanks
Dustin
 
Can you give an example of what we are trying to accomplish here?

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top