sjuarez1979
Programmer
This is what I put in:
CREATE PROCEDURE wo_EditContact
@ContactID int,
@FirstName char(10),
@LastName char(10),
@Address1 char(10),
@Address2 char(10),
@City char(10),
@State char(10),
@Zip int,
@Email char(50),
@PhoneNumber char(20),
@FAX char(20),
@Extension char(10),
@GroupName char(10),
@Username char(50),
@UsrPassword char(50),
@Retired bit
AS
DECLARE @NowDate datetime
SELECT @NowDate = GetDate()
DECLARE @SQLQuery varchar(255)
SELECT @SQLQuery =
"UPDATE tbl_Contact
SET
FirstName = '" + RTRIM(@FirstName) + "',
LastName = '" + RTRIM(@LastName) + "',
Address1 = '" + RTRIM(@Address1) + "',
Address2 = '" + RTRIM(@Address2) + "',
City = '" + RTRIM(@City) + "',
State = '" + RTRIM(@State) + "',
Zip = " + @Zip + ",
PhoneNumber = '" + RTRIM(@PhoneNumber) + "',
FAX = '" + RTRIM(@FAX) + "',
Extension = '" + RTRIM(@Extension) + "',
Email = '" + RTRIM(@Email) + "',
GroupName = '" + RTRIM(@GroupName) + "',
Username = '" + RTRIM(@Username) + "',
UsrPassword = '" + RTRIM(@UsrPassword) + "',
ContactRetired = " + @Retired + ",
RetireDate = " + @NowDate + "
WHERE ContactID = " + @ContactID
EXEC(@SQLQuery)
GO
This is what it says:
Server: Msg 245, Level 16, State 1, Procedure wo_EditContact, Line 34
Syntax error converting the varchar value 'UPDATE tbl_Contact
SET
FirstName = 'Steve',
LastName = 'Uglyint',
Address1 = '4555 S. Va',
Address2 = 'ok',
City = 'Henderson',
State = 'NV',
Zip = ' to a column of data type int.
Does anyone know how this can be corrected???
-sjuarez1979
CREATE PROCEDURE wo_EditContact
@ContactID int,
@FirstName char(10),
@LastName char(10),
@Address1 char(10),
@Address2 char(10),
@City char(10),
@State char(10),
@Zip int,
@Email char(50),
@PhoneNumber char(20),
@FAX char(20),
@Extension char(10),
@GroupName char(10),
@Username char(50),
@UsrPassword char(50),
@Retired bit
AS
DECLARE @NowDate datetime
SELECT @NowDate = GetDate()
DECLARE @SQLQuery varchar(255)
SELECT @SQLQuery =
"UPDATE tbl_Contact
SET
FirstName = '" + RTRIM(@FirstName) + "',
LastName = '" + RTRIM(@LastName) + "',
Address1 = '" + RTRIM(@Address1) + "',
Address2 = '" + RTRIM(@Address2) + "',
City = '" + RTRIM(@City) + "',
State = '" + RTRIM(@State) + "',
Zip = " + @Zip + ",
PhoneNumber = '" + RTRIM(@PhoneNumber) + "',
FAX = '" + RTRIM(@FAX) + "',
Extension = '" + RTRIM(@Extension) + "',
Email = '" + RTRIM(@Email) + "',
GroupName = '" + RTRIM(@GroupName) + "',
Username = '" + RTRIM(@Username) + "',
UsrPassword = '" + RTRIM(@UsrPassword) + "',
ContactRetired = " + @Retired + ",
RetireDate = " + @NowDate + "
WHERE ContactID = " + @ContactID
EXEC(@SQLQuery)
GO
This is what it says:
Server: Msg 245, Level 16, State 1, Procedure wo_EditContact, Line 34
Syntax error converting the varchar value 'UPDATE tbl_Contact
SET
FirstName = 'Steve',
LastName = 'Uglyint',
Address1 = '4555 S. Va',
Address2 = 'ok',
City = 'Henderson',
State = 'NV',
Zip = ' to a column of data type int.
Does anyone know how this can be corrected???
-sjuarez1979