Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Operand type clash: int is incompatible with date

$
0
0
I'm getting this error when trying to insert data into a table.
"Operand type clash: int is incompatible with date"

This is the SQL I used to create the table:
Code:

CREATE TABLE customers(
        customer_id int IDENTITY(1,1) NOT NULL,
        member_yn char(1) NOT NULL,
        membership_number int NOT NULL,
        date_became_member date NOT NULL,
        customer_first_name varchar(20) NOT NULL,
        customer_last_name varchar(20) NOT NULL,
        customer_address varchar(128) NOT NULL,
        customer_phone int NOT NULL,
        customer_email varchar(128) NOT NULL,
        customer_dob date NOT NULL);

This is the SQL I am using to add data: (Note that there are two dates in each line, scroll to the side.)
Code:

INSERT INTO customers VALUES ('y', 156, 2010-08-29, 'John', 'Smith', '1235 Main Street, Dunmore, PA 18512', 6963287654, 'jsmith@hotmail.com', 1986-06-23);
INSERT INTO customers VALUES ('y', 159, 04/15/2011, 'Mary', 'Jones', '235 Ardmore Blvd, Pittsburgh, PA 15221', 3429831594, 'jones_mary@gmail.com', 01/12/1992);

Each of the lines above to add data uses a different data format because I tried both, while commenting out the other, hoping for the problem to go away with the change in format.

It has not though.

Does anyone know what I'm doing wrong? I probably missed something easy. but I'm a student new to databases and have been unable to get this to work.
Also, there are other tables in the database that I excluded because of all the code. I can post that if needed.

Here is the SQL code to create a primary key for this table:
Code:

ALTER TABLE customers ADD CONSTRAINT pk_customers PRIMARY KEY (customer_id);
Thanks in advance.

Viewing all articles
Browse latest Browse all 13329

Trending Articles