Når jeg laver et SQL statement hvor man kan søge på forskellige ting kan jeg ved text-typer bare indtaste % for at den skal acceptere alle resultater. Men hvad gør jeg med number-typer for at opnå samme resultat? (her kan jeg jo ikke bruge like søgning)
Not the answer I was looking for... If we say I have 2 columns streetName (text) and number (number) If I want to search for all rows where the number is ie. 5 the SQL could be "select * from Table where number = 5 and streetName like '%'" (this way streetName can be anything)
But what if I want to search for all rows where streetName starts widt "Ba" (and not care about number) "select * from Table where streetName like 'Ba%' and number ???" (I don't want to just exclude number from the select statement)
Yes I have tried that, and it is not possible to do a LIKE search on a number-type column. The reason why I don't want to exclude it from the statement is that it is not required that you fill all search-fields (but you have the option) and I want to use the same SQL statement.
In Access it is possible to use like with number fields, but if you rfor example using VB.NET then I'm not sure.
I would build the SQL dynamically depending on what fields are entered.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.