September 13, 2005 at 3:10 am
Hi, i was able to insert into table 'FilesPath' two values (a,b) but if value 'a' not exist.
This is my SQL query:
INSERT INTO FilesPath
(Path,Destination)
VALUES (@a,@b)
WHERE 0 =
(SELECT COUNT(*)
FROM filespath
WHERE Destination = @a)
there is one error on WHERE statement.
How i will solve this problem???
Thanks 4 All.
September 13, 2005 at 3:57 am
Why not recast this as a conditional insert?
if not exists (SELECT destination FROM filespath WHERE Destination = @a)
begin
INSERT INTO FilesPath (Path,Destination)
VALUES (@a,@b)
end
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
September 13, 2005 at 4:24 am
Thank a lot. this is better from my code and it is work excellent.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply