Hi,
I am trying to enter a datestamp into a SET statement:
--MY CODE--
Update tbReturns
Set Details='MARKA' + CHAR(13)+ CHAR(10)+ CONVERT(varchar(max),Details)
Where ID= 16411;
I am trying to enter the timestamp after 'MARKA'
Is this even possible?
Grateful for any help...strong text
djj55
January 7, 2016, 12:04pm
2
What datatype is Details? You do not need to convert it to varchar(max) in the set command as it should already be that to except the new data.
UPDATE tbReturns
SET Details = 'MARKA' + CONVERT(VARCHAR(20), GETDATE(), 101) + CHAR(13)+ CHAR(10)+ Details
Where ID= 16411;
The Details datatype is just text.
I just want to add a timestamp after the initial text 'MARKA'
djj55
January 7, 2016, 12:22pm
4
If Details is truly TEXT then this will not work. To update a text column you need different commands.
If it is really VARCHAR, NVARCHAR or CHAR my example should work by changing the 101 to the value that gives you what you are looking for say 120.
1 Like
Thank you for your help Djj55