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
 Transact-SQL (2000)
 money datatype

Author  Topic 

cognos79
Posting Yak Master

241 Posts

Posted - 2006-11-15 : 16:03:40
I have table with field of datatype "money". how shld i write my sql statement

insert into table1
(
id,
amt,
)
values
(
1,
'0'
)

is giving error. should i put the money value in quotes or how shld i write it.

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-11-15 : 16:13:58
Try removing the comma after amt

Jay White
Go to Top of Page

cognos79
Posting Yak Master

241 Posts

Posted - 2006-11-15 : 16:28:28
jay...thats an typo
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-11-15 : 16:29:39
insert into table1
(
id,
amt
)
values
(
1,
0.0000
)
Go to Top of Page

cognos79
Posting Yak Master

241 Posts

Posted - 2006-11-15 : 16:33:45
thanks kristen
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-11-15 : 16:34:13
Then what is your error?

create table #test(id int, amt money)
insert into #test(id, amt) values(1, '0')

That works no problem. Quotes or not quotes doesn't matter, so long as what is in quotes can be implicitly converted to a money type.

Jay White
Go to Top of Page
   

- Advertisement -