Hi
I have created a stored procedure which I am calling via a VB application and it was returning an error. I have run it manually and it appears to be returning 2 responses, a return value of 0 suggesting the record is inserted correctly, but also a (No column name) value of -1. The record inserted on the table is correct so I am very much at a loss as to what the issue is! Can anyone please advise? The Stored Procedure is below:
USE [Snip-IT]
GO
/****** Object: StoredProcedure [dbo].[Insert_Salon] Script Date: 09/08/2014 11:25:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Salon]
@SalonID INT,
@TradingName NVARCHAR(30),
@AddressLine1 NVARCHAR(30),
@AddressLine2 NVARCHAR(30),
@AddressLine3 NVARCHAR(30),
@City NVARCHAR(20),
@County NVARCHAR(20),
@Postcode NVARCHAR(10),
@Telephone NVARCHAR(11),
@Fascimile NVARCHAR(11),
@EmailAddress NVARCHAR(50),
@OAPDay INT,
@ClosedDay INT,
@Active INT
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS(SELECT TradingName FROM Salon WHERE TradingName = @TradingName)
BEGIN
SELECT -1 -- Salon exists.
END
ELSE
BEGIN
INSERT INTO [Salon]
([SalonID]
,[TradingName]
,[AddressLine1]
,[AddressLine2]
,[AddressLine3]
,[City]
,[County]
,[Postcode]
,[Telephone]
,[Fascimile]
,[EmailAddress]
,[OAPDay]
,[ClosedDay]
,[Active])
VALUES
(@salonID
,@TradingName
,@AddressLine1
,@AddressLine2
,@AddressLine3
,@City
,@County
,@Postcode
,@Telephone
,@Fascimile
,@EmailAddress
,@OAPDay
,@ClosedDay
,@Active)
SELECT SCOPE_IDENTITY() -- SalonID
END
END
GO
Many thanks
Steve
I have created a stored procedure which I am calling via a VB application and it was returning an error. I have run it manually and it appears to be returning 2 responses, a return value of 0 suggesting the record is inserted correctly, but also a (No column name) value of -1. The record inserted on the table is correct so I am very much at a loss as to what the issue is! Can anyone please advise? The Stored Procedure is below:
USE [Snip-IT]
GO
/****** Object: StoredProcedure [dbo].[Insert_Salon] Script Date: 09/08/2014 11:25:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Salon]
@SalonID INT,
@TradingName NVARCHAR(30),
@AddressLine1 NVARCHAR(30),
@AddressLine2 NVARCHAR(30),
@AddressLine3 NVARCHAR(30),
@City NVARCHAR(20),
@County NVARCHAR(20),
@Postcode NVARCHAR(10),
@Telephone NVARCHAR(11),
@Fascimile NVARCHAR(11),
@EmailAddress NVARCHAR(50),
@OAPDay INT,
@ClosedDay INT,
@Active INT
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS(SELECT TradingName FROM Salon WHERE TradingName = @TradingName)
BEGIN
SELECT -1 -- Salon exists.
END
ELSE
BEGIN
INSERT INTO [Salon]
([SalonID]
,[TradingName]
,[AddressLine1]
,[AddressLine2]
,[AddressLine3]
,[City]
,[County]
,[Postcode]
,[Telephone]
,[Fascimile]
,[EmailAddress]
,[OAPDay]
,[ClosedDay]
,[Active])
VALUES
(@salonID
,@TradingName
,@AddressLine1
,@AddressLine2
,@AddressLine3
,@City
,@County
,@Postcode
,@Telephone
,@Fascimile
,@EmailAddress
,@OAPDay
,@ClosedDay
,@Active)
SELECT SCOPE_IDENTITY() -- SalonID
END
END
GO
Many thanks
Steve