hello,
I am trying make if users add new data from webpage and the serial number was add alreday, it show him the serial number already add by [id] [name] [serial number]
I am trying this code and getting error
Msg 110, Level 15, State 1, Procedure Validate_Serial, Line 13 [Batch Start Line 0] There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement
create PROCEDURE [dbo].[Validate_Serial]
(@txtmodelPC NVARCHAR(MAX)=NULL,@id int)
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS(SELECT id FROM Table_PC_Register WHERE txtmodelPC = @txtmodelPC)
BEGIN
SELECT -1-- txtmodelPC exists.
END
ELSE
BEGIN
INSERT INTO [Table_PC_Register]([txtmodelPC]) VALUES (@txtmodelPC,GETDATE())
SELECT SCOPE_IDENTITY() -- Id
END
EN