Find task with wildcards?

831
5
08-12-2014 04:16 AM
AdrianMarsden
Occasional Contributor III

Hi

I'm trying to re-create this T-SQL in a find task

SELECT     OBJECTID, UPRN, LADDRESS, PASTEADDRESS, LOGICAL_STATUS, LPIKEY, PROPERTY_TYPE, ORGANISATION, USRN, STREET_NAME, TOWN_NAME, LOCALITY,

                      POSTCODE, POSTTOWN, UPDATED, STREET_REF_TYPE, POSTALLYADDRESSABLE, PROPERTYSTATE, LPISTATUS, XREF, YREF, Shape, SortPAON

FROM         v_ADDRESSES_FULL_LLPG

WHERE     (PASTEADDRESS LIKE N'1 %FORE STREET%')

The important bit is the WHERE.

This will return "1 Fore Street" but also " 1 The Fishermans,  Fore Street" , "1 - 4 Forestreet" and a host of others.

How do I specify this in a query for a find task?


Cheers


ACM

This 

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

Adrian,

  The FindTask does not allow for a where clause as it uses a searchText property that defines the where clause internally. You can have the QueryTask use your where clause specified above. One thing that sticks out to be is the PASTEADDRESS LIKE N'1 %FORE STREET%' I have not seen the "N" used in SQL before is this a typo or does it actually do something in TSQL?

0 Kudos
AdrianMarsden
Occasional Contributor III

The N - Dunno - it is what SQL Manager puts in when you design a query - I have no idea why or what it does - I never write it myself and they always work

0 Kudos
AdrianMarsden
Occasional Contributor III

Ah

sql server - What is the meaning of the prefix N in T-SQL statements? - Stack Overflow

You may have seen Transact-SQL code that passes strings around using an N prefix. This denotes that the subsequent string is in Unicode (the N actually stands for National language character set). Which means that you are passing an NCHAR, NVARCHAR or NTEXT value, as opposed to CHAR, VARCHAR or TEXT.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Adrian,

   Good to know. So have you tried the queryTask using that where clause?

0 Kudos
AdrianMarsden
Occasional Contributor III

Not yet - it would take a fair bit of re-coding - not that urgent at the moment - thanks anyway.

0 Kudos