I am developing a website in asp.net (C#) having two languages "English"
and "Persian"
. I have a search field in front end and I want to pick the English name when I do search in English and to pick the Persian name when I do search in Persian.
I have record in table in the following format:
===========================
Name |Persian Name|
===========================
Faridullah | فریدالله |
I have a search field in front end. So I want to pick "Name" when I enter English alphabet and when the language is changed means when I enter Persian alphabet Persian name should be picked. so how could I do that in a query.
To check if string contains letters uses the operator LIKE with the following regular expression '[A-Za-z]%'.
You can use these SQL data types to store alphanumeric data: CHAR and NCHAR data types store fixed-length character literals. VARCHAR2 and NVARCHAR2 data types store variable-length character literals. NCHAR and NVARCHAR2 data types store Unicode character data only.
How do you check if a value is alphanumeric in SQL? Answer: To test a string for alphanumeric characters, you could use a combination of the LENGTH function, TRIM function, and TRANSLATE function built into Oracle. The string value that you are testing. This function will return a null value if string1 is alphanumeric.
You can simple use OR
in your WHERE
clause in following:
SELECT *
FROM Tbl
WHERE @name = Name OR @name = [Persian Name];
Or slightly shortened
SELECT *
FROM Tbl
WHERE @name IN (Name, [Persian Name]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With