Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using CONVERT() function
Message
 
 
To
07/02/2019 16:11:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
01666022
Message ID:
01666067
Views:
33
>>My code does not use the XML serializer. And I cannot change the code - now - just for this case. So, I will have to find a solution still.
>>Thank you.
>
>Do you have access to the code that is doing the serialization? If yes, would you share so we can update.
>
>If you have to live with that, there is a problem, consider:
>
>01/02/2019
>
>How would that be interpreted? It is Jan 2 in USA and Feb 1 in Europe. Assuming, in such case you would favor US settings (could be instead server default), I have created a demo code for you (SQL Server 2012 and later):
>
>https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=dda4d99a3924f79400ee650a0f822ae4

I do have the code that does "serialization." I am writing the serialization in quotes because my code does not really do it. It was "my way" of storing multiple values in the ASP.NET and passing it to the SQL Server SP.

But the key is in the SQL Server stored procedure where the value of the DateTime is extracted. This is the code (I am reposting it):
SELECT @TargetDate = [Fld FldName].value('.','char(10)') FROM @XmlDocWo.nodes('/WORK_HIS/Fld') Fld([Fld FldName]) WHERE [Fld FldName].value('@name','varchar(20)') = 'DATE_TARG'
The XML string XmlDocWo is passed to the SQL Server SP. And this XML has many purposes in the SP; so it is not so easy for me to change it. Although I admit there must be a better way to create this XML. I can't just do it "on-the-fly" since it changes a lot in many places.
Please see my reply to myself about the format of the datetime string I finally use (in the ASP.NET). For now, at least, this resolved the issue.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform