How to convert getdate() stored as varchar to date
0
votes
2
answers
354
views
I have stored 'getdate()' as text in one of my column in a table. (It's a complicated scenario ,how I saved it)
Now when I select the field what I am getting is getdate() instead of the date . How can I convert this to date time.
I am adding a sample code to understand this
declare @a varchar(20)='getdate()'
select convert(datetime,@a)
This results in conversion error. How can I convert this to date?
Asked by Viz Krishna
(109 rep)
Jan 23, 2023, 10:40 AM
Last activity: Jan 23, 2023, 11:50 AM
Last activity: Jan 23, 2023, 11:50 AM