I have a VB6 program that builds SQL statements on the fly. I was hoping to put the 'core' of my SQL statement in a stored procedure and simply pass the VB-built WHERE statement to the procedure to execute. However, SQL Server doesn't like the syntax of the following:
CREATE PROCEDURE sp_test @wherestmt varchar(64)
AS
SELECT * FROM tbltest @wherestmt
GO
For example, the VB program might pass " WHERE (x = 4)" in hopes of creating "SELECT * FROM tbltest WHERE (x = 4)"
Is this possible?
Right now I simply concatenate my WHERE statement to the end of my 'core' (SELECT * FROM tbltest) and pass the entire statement to SQL Server... just trying to make use of a stored procedure in a strange sort of way...
Comments, suggestions?
CREATE PROCEDURE sp_test @wherestmt varchar(64)
AS
SELECT * FROM tbltest @wherestmt
GO
For example, the VB program might pass " WHERE (x = 4)" in hopes of creating "SELECT * FROM tbltest WHERE (x = 4)"
Is this possible?
Right now I simply concatenate my WHERE statement to the end of my 'core' (SELECT * FROM tbltest) and pass the entire statement to SQL Server... just trying to make use of a stored procedure in a strange sort of way...
Comments, suggestions?