Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 my query gives me and error

Author  Topic 

bzeus
Starting Member

1 Post

Posted - 2005-11-01 : 22:58:19
hello everybody...i'm just getting into SQL server 2000 so i'm a real newbie i created a query and it gives me an error...the query and the error is as below....please help me out, tnx a lot in advance..=)

use test2
create table employee
(
first_name varchar(30),
last_name varchar(30),
address varchar(50),
icno int(50)
)
insert into employee values ('derric', 'jacob', 'gjhgjhgsdfsdf', 2343205435)
insert into employee values ('johnson', 'elson', 'sdfsddfsdf', 523405435)
insert into employee values ('peter', 'gunam', 'sdfsdfsdfsdf', 34235105435)
insert into employee values ('chris', 'ryan', 'gjfsdfjhgsdfsdf', 2345105435)

select * from employee


Server: Msg 2716, Level 16, State 1, Line 2
Column or parameter #4: Cannot specify a column width on data type int.

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2005-11-01 : 23:34:36
use test2
create table employee
(
first_name varchar(30),
last_name varchar(30),
address varchar(50),
icno int) -- While declaring a field as int, its not required to specify the size.
)

This will create the table.

There is also a problem with the insert statements you have. You are trying to insert a bigger value in int. And that will cause Arithmatic over flow. Please increase the size by declaring it bigint.

Regards
Sachin Samuel


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-02 : 00:11:22
See Books On Line, SQL Server help file for more info on Data types and their min and max values

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -