简体   繁体   中英

SQL Server error Operand type clash: int is incompatible with date

I am inserting values into my table and I'm stuck in a Date datatype problem. Does anyone know how to fix this?

create table filme
(
    cod_filme int primary key,
    titulo varchar (20),
    ano int,
    time int,
    idioma varchar (20),
    data_lancamento date,
    país_lancamento varchar (20)
);

insert into filme values
         (902, 'The Innocents', 1961, 100, 'English', '1962-02-19', 'SW'),
         (903, 'Lawrence of Arabia', 1962, 216, 'English', '1962-12-11', 'UK'),
         (904, 'The Deer Hunter', 1978, 183, 'English', '1979-03-08', 'UK'),
         (905, 'Amadeus', 1984, 160, 'English', '1985-01-07', 'UK'),
         (906, 'Blade Runner', 1982, 117, 'English', '1982-09-09', 'UK'),
         (907, 'Eyes Wide Shut', 1999, 159, 'English', NULL,'UK'),
         (908, 'The Usual Suspects', 1995, 106, 'English', '1995-08-25', 'UK'),
         (909, 'Chinatown', 1974, 130, 'English', '1974-08-09', 'UK'),
         (910, 'Boogie Nights', 1997, 155, 'English', '1998-02-16', 'UK'),
         (911, 'Annie Hall', 1977, 93, 'English', '1977-04-20', 'USA'),
         (912, 'Princess Mononoke', 1977, 134, 'Japanese', '2001-10-19', 'UK'),
         (913, 'The Shawshank Redemption', 1994, 142, 'English', '1995-02-17', 'UK'),
         (914, 'American Beauty', 1999, 122, 'English', NULL,'UK')

Some internationalization settings can affect the interpretation of dates in the YYYY-MM-DD format.

The format without hyphens, YYYYMMDD, always works. So you can try, say, '19950217' instead of '1995-02-17' .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM