SELECT LANGUAGE from PHP

Copper Contributor

Hi, friends,

 

If I write SELECT @@language in Management Studio I obtain 'Spanish' but if I do from PHP 5 (Apache 2.2) I obtain 'us_english'.

 

How can I configure my PHP (or Apache) to obtain 'Spanish'.

 

In SQL Server properties I have default language=Spanish

 

Thanks a lot in advance

5 Replies
The default language is bound to the SQL Server login; are you using the same login for both SSMS + PHP?
See https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-login-transact-sql?view=sql-server-ver1... => DEFAULT_LANGUAGE

Hi, @olafhelper ,

 

Thanks for your response. Yes, I am using same authentication for both systems.

 

Maybe I need to add a line in php.ini about the language?

 

Kind regards

 

 

@Carlos_J_Ro , the effective language setting is session related, you can change it with

SET LANGUAGE (Transact-SQL) - SQL Server | Microsoft Learn

Hi, Olaf,

Yes, this is the solution we are applying but I would like to avoid it because it means to add this query to all queries.

Thanks and kind regards
Go to the security section in SSMS and right-click on the user you are logging in with from PHP then select properties.

At the bottom of the general tab select the database you are connecting to then select the language. Your PHP login then should pick up the Spanish local settings.

and as my wife is Spanish I had to learn so:

Vaya a la sección de seguridad en SSMS y haga clic derecho en el usuario con el que está iniciando sesión desde PHP y luego seleccione propiedades.

En la parte inferior de la pestaña general, seleccione la base de datos a la que se está conectando y luego seleccione el idioma. Su inicio de sesión de PHP debería seleccionar la configuración local en español.