- Joined
- Oct 14, 2019
- Messages
- 11
- Reaction score
- 1
Hello everyone,
I would like to modify the default query but if I use multiple time the variable in the WHERE clause, query does not work anymore.
EXAMPLE:
- This query work:
- This query does not work:
Error message when I click test:
If I test in MS SQL Management Studio like this, query is working:
Does anyone know what would be the problem and how to solve it ?
Thanks !
BEHD
Note. Of course, remove all "_" from queries.
[EDIT] Note2. To avoid forum translation, there's now a space between @ and Number, it should be removed to run query
I would like to modify the default query but if I use multiple time the variable in the WHERE clause, query does not work anymore.
EXAMPLE:
- This query work:
S_ELECT contactid, firstname, lastname, email, phonebusiness, phonemobile, faxbusiness F_ROM MyDBname.dbo.CRM3CX W_HERE phonebusiness L_IKE C_ONCAT('%',@ Number,'%')- This query does not work:
S_ELECT contactid, firstname, lastname, email, phonebusiness, phonemobile, faxbusiness F_ROM MyDBname.dbo.CRM3CX W_HERE phonebusiness L_IKE C_ONCAT('%',S_UBSTRING(@ Number, P_ATINDEX('%[^0]%', @ Number+'.'), L_EN(@ Number)),'%')Error message when I click test:
Must declare the scalar variable "@".If I test in MS SQL Management Studio like this, query is working:
d_eclare @ Number v_archar( 64)
s_et @ Number = '00123456789'
S_ELECT contactid, firstname, lastname, email, phonebusiness, phonemobile, faxbusiness
F_ROM MyDBname.dbo.CRM3CX W_HERE phonebusiness L_IKE C_ONCAT('%',S_UBSTRING(@ Number, P_ATINDEX('%[^0]%', @ Number+'.'), L_EN(@ Number)),'%')
Does anyone know what would be the problem and how to solve it ?
Thanks !
BEHD
Note. Of course, remove all "_" from queries.
[EDIT] Note2. To avoid forum translation, there's now a space between @ and Number, it should be removed to run query
Last edited: