Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & SQL-Server
PHP & SQL-Server Forum d'entraide sur SQL-Server avec PHP. Avant de poster -> FAQ SQL-Server
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 22/01/2007, 09h31   #1
Membre éclairé
 
Inscription : octobre 2006
Messages : 345
Détails du profil
Informations personnelles :
Âge : 43

Informations forums :
Inscription : octobre 2006
Messages : 345
Points : 301
Points : 301
Par défaut mssql_fetch, pb nb caractères retournés

Bonjour,

Dans une table (sql-server), j'extrais un enregistrement (colonne de type nvarchar) dont la taille dépasse les 300 caratères via mssql_fetch_assoc, ou mssql_fetch_object.
Cependant, l'enregistrement retourné ne dépasse pas 250 caractères.
Or via SQL Manager 2005 lite, l'extraction renvoie bien la totalité des caratères.

Auriez-vous des infos sur ce problème.
Merci

jlmag
jlmag est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/01/2007, 10h44   #2
Expert Confirmé Sénior
 
Avatar de Mr N.
 
Inscription : septembre 2004
Messages : 5 421
Détails du profil
Informations forums :
Inscription : septembre 2004
Messages : 5 421
Points : 5 835
Points : 5 835
Voici des infos pour toi =>
Citation:
Buried away in the mssql_field_length documentation is an important limitation that it is certainly worth knowing about *BEFORE* you do any database design:

Note to Win32 Users: Due to a limitation in the underlying API used by PHP (MS DbLib C API), the length of VARCHAR fields is limited to 255. If you need to store more data, use a TEXT field instead.

SQL Server natively supports VARCHAR up to 8000 characters. Note that TEXT fields have substantially poorer performance (and are much more limited) than VARCHAR so you may want to design your databases accordingly...

You can also work around this limitation with the following:
Code :
1
2
3
 
   -- for example, with MyVarCharField VARCHAR(1000)
   SELECT CAST(MyVarCharField AS TEXT) FROM MyTable
__________________
Get your motor runnin'
Head out on the highway...
Mr N. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/01/2007, 12h21   #3
Membre éclairé
 
Inscription : octobre 2006
Messages : 345
Détails du profil
Informations personnelles :
Âge : 43

Informations forums :
Inscription : octobre 2006
Messages : 345
Points : 301
Points : 301
Rebonjour,

Test concluant !
Via la convertion de type de colonne en TEXT, cela fonctionne parfaitement.
Encore merci Mr N.

A bientôt
jlmag
jlmag est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 17h58.


 
 
 
 
Partenaires

Hébergement Web