je me permet de réouvrir le ticket.
je pense plus à un bug de chez crosoft car quand j'execute la requête dans sql management studio ça fonctionne,
par contre dans l'app ça foire.
plus exactement :
le group by fonctionne bien, par contre lorsque je veux l'intégrer dans le select, il me met un "Input string was not in a correct format."
lorsque je change [THEN 'Sent to ...' ELSE p.text END]
en [THEN 5 ELSE 3 END]
la requête s'execute correctement, mais ne calcule plus les moyennes.
exactement la même requête dans le manager studio me calcule quand même la moyenne.
pourquoi veut-il vonvertir mon varchar en Int ?
j'ai essayé des convert dans tous les sens, c'est pas mieux.
toujours des erreurs, alors quand dans le studio manager, tout fonctionne.
pour faire compliqué, voici ma requête complète:
select (CASE WHEN p.text LIKE 'Sent to%' THEN 'Sent to ...' ELSE p.text END),avg(datediff("dd",t.CreateDate,GETDATE())) FROM Ticket t, PickList p WHERE t.StatusCode=p.itemid AND 1=1 AND (p.text LIKE 'Open' OR p.text LIKE 'In Process' OR p.text LIKE 'Pre-Closed' OR p.text LIKE 'Sent to%') GROUP BY CASE WHEN p.text LIKE 'Sent to%' THEN 'Sent to ...' ELSE p.text END
le stacktrace ?
ok, si vous voulez :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7469351
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
System.String.System.IConvertible.ToInt32(IFormatProvider provider) +46
System.Convert.ToInt32(Object value) +28
NHibernate.Type.Int32Type.Get(IDataReader rs, Int32 index) +82
[FormatException: Input string 'Sent to ...' was not in the correct format.]
...
[ADOException: could not execute query
[ select (CASE WHEN p.text LIKE 'Sent to%' THEN 'Sent to ...' ELSE p.text END),avg(datediff("dd",t.CreateDate,GETDATE())) FROM Ticket t, PickList p WHERE t.StatusCode=p.itemid AND 1=1 AND (p.text LIKE 'Open' OR p.text LIKE 'In Process' OR p.text LIKE 'Pre-Closed' OR p.text LIKE 'Sent to%') GROUP BY CASE WHEN p.text LIKE 'Sent to%' THEN 'Sent to ...' ELSE p.text END ]
[SQL: select (CASE WHEN p.text LIKE 'Sent to%' THEN 'Sent to ...' ELSE p.text END),avg(datediff("dd",t.CreateDate,GETDATE())) FROM Ticket t, PickList p WHERE t.StatusCode=p.itemid AND 1=1 AND (p.text LIKE 'Open' OR p.text LIKE 'In Process' OR p.text LIKE 'Pre-Closed' OR p.text LIKE 'Sent to%') GROUP BY CASE WHEN p.text LIKE 'Sent to%' THEN 'Sent to ...' ELSE p.text END]] |
Partager