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)
 inserting a date value in datetime using a convert function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-16 : 09:27:53
nikhil writes "dear sir
if i give the syntax
insert into ppbs(trndate) values(convert(datetime(10),'1-3-99',105)

it works in sql server 7.0 but it gives an error in sql server 2000
that

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]CAST or CONVERT: invalid attributes specified for type 'datetime'


so please help for a proper syntax for convert function"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-16 : 09:44:17
The datetime data type does not have a size option, so the following is all you need:

insert into ppbs(trndate) values( convert(datetime,'1-3-99',105) )

Go to Top of Page
   

- Advertisement -