CrimsonDiva
Programmer
Hi!
I'm having a problem checking for the existence of a record in a table when the input is a comma-delimited list.
In the stored procedure below, I need to first check to see if a record exists in the database with the group and tool id's. If not, I want to add the new record. But something's wrong with my code. See below:
ALTER PROCEDURE sp_mysp
@groupid VARCHAR(1000),
@toolid INT
AS
IF NOT EXISTS(SELECT group_id, tool_id FROM group_tools WHERE group_id IN (@groupid) AND tool_id= @toolid)
-- insert new record into group_tools
The latter portion of the stored procedure works, but I know there's a problem some where around that IN operator.
Please help!
Thanks!
I'm having a problem checking for the existence of a record in a table when the input is a comma-delimited list.
In the stored procedure below, I need to first check to see if a record exists in the database with the group and tool id's. If not, I want to add the new record. But something's wrong with my code. See below:
ALTER PROCEDURE sp_mysp
@groupid VARCHAR(1000),
@toolid INT
AS
IF NOT EXISTS(SELECT group_id, tool_id FROM group_tools WHERE group_id IN (@groupid) AND tool_id= @toolid)
-- insert new record into group_tools
The latter portion of the stored procedure works, but I know there's a problem some where around that IN operator.
Please help!
Thanks!