PeterBaileyUk
asked on
sqlserver datetime conversion error
I am trying to insert into a table but its giving me an error message and I dont know how to deal with it.
the columns in the destination are as per attached
word is a string containing one wordof nvarchar(50)
MyDateTime is the date and time
the primary key is made up of the word and datetime.
Msg 241, Level 16, State 1, Line 3
Conversion failed when converting date and/or time from character string.
the columns in the destination are as per attached
word is a string containing one wordof nvarchar(50)
MyDateTime is the date and time
the primary key is made up of the word and datetime.
Msg 241, Level 16, State 1, Line 3
Conversion failed when converting date and/or time from character string.
use Dictionary
insert into TblCurrentWords (Word_ID, Word, MyDateTimeCol)
select Word + GETDATE() AS CurrentDateTime, word, GETDATE() AS MyDateTimeCol
from TblWords
where word is not null and PATINDEX('%[0-9]%',Word)=0
group by word
order by word
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the primary key is made up of (a concatenation of) the word and datetime.
That is NOT a good way to define the table
You could make the unique key a combination of word and a datetime column, but do not concatenate them
That is NOT a good way to define the table
You could make the unique key a combination of word and a datetime column, but do not concatenate them
oh no too late...
ASKER