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)
 Disallowed Implicitness

Author  Topic 

Lord Dubu
Starting Member

12 Posts

Posted - 2004-05-21 : 10:19:56
We've got a table here at work that's been up and running for a long time. I need to insert a row of test data into that table, so I tried like this:

insert into payments values('xxx','xxx','xxx','58.98')

this yilded the result:
Disallowed implicit conversion from data type varchar to data type money, table server.dbo.payments', column 'Amount'. Use the CONVERT function to run this query.

Ok, says I... how about this:

insert into club_payflow values('xxx','xxx','xxx',convert(money,'58.85')

no such luck:
Server: Msg 8152, Level 16, State 9, Line 1
String or binary data would be truncated.
The statement has been terminated.

hmmmm OK:
insert into club_payflow values('xxx','xxx','xxx',cast('58.85' as money)

Again with:
Server: Msg 8152, Level 16, State 9, Line 1
String or binary data would be truncated.
The statement has been terminated.

The value should fit as there are other rows with that value already.

I know the column is datatype:money.

ijprasad
Starting Member

29 Posts

Posted - 2004-05-21 : 10:30:41
try this

insert into club_payflow values('xxx','xxx','xxx',convert(money, 58.85)

Inderjeet
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2004-05-21 : 10:32:04
Remove the single quotes around 58.98
Go to Top of Page

Lord Dubu
Starting Member

12 Posts

Posted - 2004-05-21 : 10:34:21
Yeah I tried both cast and convert without the single quotes, still no luck.
Go to Top of Page

Lord Dubu
Starting Member

12 Posts

Posted - 2004-05-21 : 10:54:47
Sorry. Newb mistake. Two different errors. The first -was- solved by the converstion. The truncation error was the result of one of the 'xxx' columns. Nothing to see here. Move along :)
Go to Top of Page
   

- Advertisement -