I'm having an interesting situation with a SQL Server proc. The issue is that the new data is getting into the "Restaurants" table, but only some data is making it into the "Partner_Has_Vendors" table. Specifcally there are 125 records in the initial test and only 24 ended up in the second table.
Any thoughts?
Here is some of the proc code:
BEGIN
SELECT @iCOUNT = COUNT(RST_UID)
FROM Restaurants.dbo.RESTAURANTS
WHERE RST_LONGITUDE = @fRestaurantLongitude
AND RST_LATITUDE = @fRestaurantLatitude
END
BEGIN
IF @iCount = 0
BEGIN
INSERT INTO Restaurants.dbo.RESTAURANTS (
RST_NAME,
RST_STREET,
RST_CITY,
RST_STT_UID,
RST_ZIP,
RST_ZIP4,
RST_PHONE,
RST_DELIVERY,
RST_TAKEOUT,
RST_LONGITUDE,
RST_LATITUDE,
RST_PARTNERS_UID,
RST_ON_WEB,
RST_TRACKING,
RST_TRACKING_FAX)
VALUES (
@sRestaurantName,
@sRestaurantAddress,
@sRestaurantCity,
@iStateID,
@sRestaurantZIPCode,
@sRestaurantZIPCodePlusFour,
@sRestaurantPhone,
@bDelivery,
@bTakeOut,
@fRestaurantLongitude,
@fRestaurantLatitude,
@iRestaurantID,
@iRestaurantOnline,
1,
0)
SELECT @iRestaurantID = @@IDENTITY
INSERT INTO Customers.dbo.PARTNER_HAS_VENDORS (
PHV_PTR_UID,
PHV_RST_UID,
PHV_LEVEL1_SALES,
PHV_LEVEL1_COMMISSION)
VALUES (
@iPartnerID,
@iRestaurantID,
0,
0)
-- IMPORTANT: Do we have have values for these two fields???
Question
James Rose
I'm having an interesting situation with a SQL Server proc. The issue is that the new data is getting into the "Restaurants" table, but only some data is making it into the "Partner_Has_Vendors" table. Specifcally there are 125 records in the initial test and only 24 ended up in the second table.
Any thoughts?
Here is some of the proc code:
BEGIN
SELECT @iCOUNT = COUNT(RST_UID)
FROM Restaurants.dbo.RESTAURANTS
WHERE RST_LONGITUDE = @fRestaurantLongitude
AND RST_LATITUDE = @fRestaurantLatitude
END
BEGIN
IF @iCount = 0
BEGIN
INSERT INTO Restaurants.dbo.RESTAURANTS (
RST_NAME,
RST_STREET,
RST_CITY,
RST_STT_UID,
RST_ZIP,
RST_ZIP4,
RST_PHONE,
RST_DELIVERY,
RST_TAKEOUT,
RST_LONGITUDE,
RST_LATITUDE,
RST_PARTNERS_UID,
RST_ON_WEB,
RST_TRACKING,
RST_TRACKING_FAX)
VALUES (
@sRestaurantName,
@sRestaurantAddress,
@sRestaurantCity,
@iStateID,
@sRestaurantZIPCode,
@sRestaurantZIPCodePlusFour,
@sRestaurantPhone,
@bDelivery,
@bTakeOut,
@fRestaurantLongitude,
@fRestaurantLatitude,
@iRestaurantID,
@iRestaurantOnline,
1,
0)
SELECT @iRestaurantID = @@IDENTITY
INSERT INTO Customers.dbo.PARTNER_HAS_VENDORS (
PHV_PTR_UID,
PHV_RST_UID,
PHV_LEVEL1_SALES,
PHV_LEVEL1_COMMISSION)
VALUES (
@iPartnerID,
@iRestaurantID,
0,
0)
-- IMPORTANT: Do we have have values for these two fields???
END
ELSE
Link to comment
Share on other sites
5 answers to this question
Recommended Posts