I have a query similar to the following:
declare @emailLinkID int
if not exists (
select emailLinkID from emailLinks
where linkURL='https://www.someurl.com'
)
begin
insert into emailLinks (
linkURL
) values (
'https://www.someurl.com,
)
set @emailLinkID = @@IDENTITY
select @emailLinkID as emailLinkID
end
This works fine when the record doesn't exist. But it doesn't return the id
if the record does exist. What am I doing wrong?
Russ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232654
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54