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
 General SQL Server Forums
 New to SQL Server Programming
 Unable to perform insert due to date

Author  Topic 

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2011-08-04 : 04:17:13
I am performing the following statement to insert a number of rows.

insert into dbo.UPDATE_HISTORY ([TABLE_ALTERED]
,[COLUMN_ALTERED]
,[TABLE_KEY]
,[LOOKUP_TABLE]
,[LOOKUP_COLUMN]
,[LOOKUP_KEY_COLUMN]
,[LOOKUP_KEY]
,[ALTERED_TEXT]
,[ALTERED_DATE]
,[ALTERED_DEC]
,[ALTERED_INT]
,[USER_NAME]
,[DATE_ALTERED]
,[DATE_EFFECTIVE])

select

'member', 'member_grade', [member_ref], 'membership_grade',
'description', 'MEMBER_GRADE_REF', '99', ' ', 'NULL', '0.000', '0',
'testing', '2011-08-03 00:00:00', '2011-08-03 00:00:00'

from member where member_grade = 99
and member_status = 33


and i receive the following error

Msg 241, Level 16, State 1, Line 2
Conversion failed when converting datetime from character string.


the date columns are datetime

dont understand why it doesnt like it.

MCTS / MCITP certified

diab
Starting Member

1 Post

Posted - 2011-08-04 : 04:30:07
Looks like its the [ALTERED_DATE] your trying to put the string 'null' in it.

Try taking off the quotes
Go to Top of Page
   

- Advertisement -