Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using CONVERT() function
Message
 
 
À
08/02/2019 07:42:51
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
01666022
Message ID:
01666102
Vues:
31
>>I don't know. It is just when I set the value in the XML (again using my own serializer) and then (in the SQL Server SP) I try to get the value back, I get the error. It appears that the code in the SQL Server SP expects the separators. Why?, I don't know.
>
>Your code:
>
>
SELECT @TargetDate = [Fld FldName].value('.','char(10)') ...
>
>forces the result to be 10 characters wide, with no separators, there are 2 spaces trailers that would cause an exception. Simply use varchar(10) instead of char(10). If time might be included then that would be more than 10 or shifting would cause first character to be included, prefer something like varchar(20).

I think you are right. I saw this last night too, when trying to figure out what is wrong with my code. I will change it today and test with either varchar(10) or char(8) and date without separators. I will let you know how it works.
Thank you.
"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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform