Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.
CREATE PROCEDURE dbo.VendorCoverageInsert ( @UserId VarChar(50), @VendorId Varchar(50), @ddCounty varchar(30), @ddStateKey int ) AS BEGIN SET NOCOUNT ON; DECLARE @Zips TABLE ( PostalCode varchar(5) ) INSERT INTO @Zips (PostalCode) SELECT u.USPostalCode FROM USCounty AS u INNER JOIN State ON u.USStateAbbr = State.StateAbbr WHERE (State.StateKey = @ddStateKey) AND (u.USCounty = @ddCounty) INSERT INTO VendorCoverageArea (CreatedUser, VendorId, ModifiedUser,ZipCode) SELECT @UserId, @VendorId,@UserId, USPostalCode FROM Zips WHERE NOT EXISTS (SELECT * FROM VendorCoverageArea Inner JOIN Zips vca.ZipCode=Zips.ZipCode WHERE VendorId = @VendorId and VendorCoverageArea.ZipCode=Zips.PostalCode )
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.