PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → SQL Syntax not supported in WD 22
SQL Syntax not supported in WD 22
Iniciado por guest, 05,sep. 2017 01:01 - 4 respuestas
Publicado el 05,septiembre 2017 - 01:01
Hi,

I use SQL Server for my backend database with windev and it appears that WD 22 no longer allows certain SQL syntax that worked in previous versions.

1. using CONVERT in a SELECT statement now gives a syntax error.

example: CONVERT(int,Booking_passenger.Room_Number) AS Room_Number_Int,

In the above example the IDE gives an "unexepected word" error on the second ")".

2. Using DATEPART no longer works in a WHERE clause.

example: DATEPART(year, Booking_History.Departure_Date) = {pYearNUmber}

in the above example "year" gives the error "year item unknown in file".

I've contacted technical support but I wonder if anyone else has run into this?

Thanks

steve
Publicado el 05,septiembre 2017 - 08:22
Hi Steve,

As an alternative to 1 you may want to use CAST instead of CONVERT.
CAST(Booking_passenger.Room_Number as int) AS Room_Number_Int
For 2 I don't have a direct alternative at mind.

Cheers,

Peter Holemans
Publicado el 05,septiembre 2017 - 21:08
It appears that while the queries give warnings they will execute.

However, queries saved as SQL are no longer available to be used as basis for reports in WD 22.
[attachment 2435 queryreportsv22.jpg]
Miembro registrado
2.682 mensajes
Publicado el 06,septiembre 2017 - 05:28
Hi,

Do you use hQueryWithoutCorrection when you are executing you queries ?

The doc says:
CONVERT is used to convert a character string from a character set to another one.

Use format:
CONVERT(Text to Convert, Charset Used, New Charset)

Example: Converting a string from UTF-8 to LATIN1: 
SELECT CONVERT('text in utf8', 'UTF8', 'LATIN1')


So if you're not using hQueryWithoutCorrection it will not work, you have to use CAST
CAST is used to convert a data from a type to another one.
CAST(Expression AS Type)


https://doc.windev.com/en-US/…

--
Cordialement,

Philippe SAINT-BERTIN
Géode Informatique
Publicado el 06,septiembre 2017 - 18:47
Update... you can use these, but must select from within report description.

Additionally, these queries now need to be run using hquerywithoutcorrection which was not required in WD 20 and prior.

I've gotten my code straightened now, but it was a lost day and a half.