0

I want to convert the result of this query (string to DateTime)

SET [something] = dbo.fn_GetProfileElement('WelcomeSent',PropertyNames,PropertyValuesString)
FROM aspnet_Profile where  aspnet_Profile.UserId = CTUsers.userid

so I try this:

SET [something] = CONVERT(DATETIME,(dbo.fn_GetProfileElement('WelcomeSent',PropertyNames,PropertyValuesString)
    FROM aspnet_Profile where  aspnet_Profile.UserId = CTUsers.userid),101)

But I receive this error:

Incorrect syntax near the keyword 'FROM'.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
atroul
  • 51
  • 1
  • 13
  • 1
    You forgot the `select`. – laurent Mar 08 '17 at 15:51
  • I want to SET a column with the results of this query. I updated the query – atroul Mar 08 '17 at 15:54
  • @this.lau_ when I added the select I receive this error: Conversion failed when converting date and/or time from character string. Which is the same with the one I received when I didnt convert the query at all – atroul Mar 08 '17 at 15:57
  • Are you attempting to update a table that has a column called `something`? can you provide the code for that function? (`dbo.fn_GetProfileElement`) – Paul Maxwell Oct 14 '17 at 06:11

0 Answers0