Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using CAST causes following error. can't find out why:-

Status
Not open for further replies.

wadey

Programmer
Jun 6, 2006
54
GB
Server: Msg 291, Level 16, State 1, Line 1
CAST or CONVERT: invalid attributes specified for type 'smallmoney'

SQL:-


INSERT INTO [New_Data] VALUES('Some Data','1','12345','DMS','data','','10/07/2006',CAST('100' as smallmoney(4)),CAST('0' as smallmoney(4)),CAST('0' as smallmoney(4)),'data',2006,'10/07/2006','','','£');
 
Code:
INSERT INTO [New_Data] VALUES
 ('Some Data','1','12345',
  'DMS','data','','10/07/2006',
   CAST('100' as smallmoney),
   CAST('0' as smallmoney),
   CAST('0' as smallmoney),
   'data',2006,'10/07/2006','','','£')
But there is no need to CAST numeric values, you can direcly do something like:

Code:
INSERT INTO [New_Data] VALUES
 ('Some Data','1','12345',
  'DMS','data','','10/07/2006',
   100,
   0,
   0,
   'data',2006,'10/07/2006','','','£')

(not tested)

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top