Computing.Net > Forums > Windows XP > Problem in inserting values to a table in SQL

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Problem in inserting values to a table in SQL

Reply to Message Icon

Name: Daisy B.
Date: July 27, 2009 at 05:51:19 Pacific
OS: Win XP
CPU/Ram: Dual core/ 2GB
Subcategory: General
Comment:

I have created a table in SQL Server as-

create table weatherreport
(places varchar(20),
cdate datetime,
maxm int,
minm int,
vdescription varchar(40))

Then I tried to insert the corresponding values as-

insert weatherreport
values('guwahati','07-01-09',31.4,26.7,'cloudy sky with one or two spells of rain or thunderstorms')

But I got a message as-
"String or binary data would be truncated.
The statement has been terminated."

Then I tried the following-

insert weatherreport(places,cdate,maxm, minm,vdescription)
values('guwahati','07-01-09',31.4,26.7,'cloudy sky with one or two spells of rain or thunderstorms')

But I got the same message. I couldn't find out my mistake. Please help me on this.



Sponsored Link
Ads by Google

Response Number 1
Name: Ewen
Date: July 27, 2009 at 20:28:08 Pacific
Reply:

You should post this in the Programming forum.

http://ewen.uuuq.com/


0

Response Number 2
Name: jon_k
Date: July 28, 2009 at 06:05:10 Pacific
Reply:

You're inserting decimal values in a column which you've said is an integer.

maxm and minm are both created as integers, then you're trying to drop in 31.4 and 26.7

In mysql, you'd create the table with decimal(x,y) (I *think* it's NUMERIC(x,y) in MS SQL) where x is the number of characters in the full number (including decimal places), and y is the number of characters that should come after the decimal point.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


dual booting problem Remove all Data so I can ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Problem in inserting values to a table in SQL

need to rotate a table in Word www.computing.net/answers/windows-xp/need-to-rotate-a-table-in-word/146435.html

.gif/.jpeg problem in outlook www.computing.net/answers/windows-xp/gifjpeg-problem-in-outlook/25600.html

Odd shutdown/reboot problem in XP www.computing.net/answers/windows-xp/odd-shutdownreboot-problem-in-xp/1359.html