sql-like

SQL LIKE operator not showing any result when it should

浪尽此生 提交于 2021-02-19 13:03:47
问题 I got a Vehicle table with lots of info but one of the columns being 'Owner' in a MSSQL table But one of the owners i can't select when i use LIKE but can if i use = 'Silkeborg Distributionscenter' is the owner (Yes there is a double space in both the table and the param) So the param is: DECLARE @Owners nvarchar(MAX) = 'Silkeborg Distributionscenter' I tried: SELECT * FROM Vehicle WHERE @Owners = Owner --This gave me all the correct results Then: SELECT * FROM Vehicle WHERE @Owners LIKE

SQL LIKE operator not showing any result when it should

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-19 12:54:34
问题 I got a Vehicle table with lots of info but one of the columns being 'Owner' in a MSSQL table But one of the owners i can't select when i use LIKE but can if i use = 'Silkeborg Distributionscenter' is the owner (Yes there is a double space in both the table and the param) So the param is: DECLARE @Owners nvarchar(MAX) = 'Silkeborg Distributionscenter' I tried: SELECT * FROM Vehicle WHERE @Owners = Owner --This gave me all the correct results Then: SELECT * FROM Vehicle WHERE @Owners LIKE

Search keyword with LIKE %[keyword]%

爷,独闯天下 提交于 2021-02-10 23:44:50
问题 I have a TransactionDetails table with TransactionId , TransactionDetail columns, those are used to track all the transactions within the application. The sample records of the TransactionDetail are: [Blah][Log] 20 Records Inserted [Blah][Exception] Fails on INSERT INTO [Blah][Error] Authentication Fails Logged [Blah][Warning] Null value is eliminated by an aggregate [Blah][Log] 10 Records Deleted I want to filter the TransactionDetail columns having the [Log] only (The Log, Logged keyword

Search keyword with LIKE %[keyword]%

允我心安 提交于 2021-02-10 23:44:31
问题 I have a TransactionDetails table with TransactionId , TransactionDetail columns, those are used to track all the transactions within the application. The sample records of the TransactionDetail are: [Blah][Log] 20 Records Inserted [Blah][Exception] Fails on INSERT INTO [Blah][Error] Authentication Fails Logged [Blah][Warning] Null value is eliminated by an aggregate [Blah][Log] 10 Records Deleted I want to filter the TransactionDetail columns having the [Log] only (The Log, Logged keyword

Search keyword with LIKE %[keyword]%

你离开我真会死。 提交于 2021-02-10 23:37:55
问题 I have a TransactionDetails table with TransactionId , TransactionDetail columns, those are used to track all the transactions within the application. The sample records of the TransactionDetail are: [Blah][Log] 20 Records Inserted [Blah][Exception] Fails on INSERT INTO [Blah][Error] Authentication Fails Logged [Blah][Warning] Null value is eliminated by an aggregate [Blah][Log] 10 Records Deleted I want to filter the TransactionDetail columns having the [Log] only (The Log, Logged keyword

Search keyword with LIKE %[keyword]%

三世轮回 提交于 2021-02-10 23:35:37
问题 I have a TransactionDetails table with TransactionId , TransactionDetail columns, those are used to track all the transactions within the application. The sample records of the TransactionDetail are: [Blah][Log] 20 Records Inserted [Blah][Exception] Fails on INSERT INTO [Blah][Error] Authentication Fails Logged [Blah][Warning] Null value is eliminated by an aggregate [Blah][Log] 10 Records Deleted I want to filter the TransactionDetail columns having the [Log] only (The Log, Logged keyword

Applying string function in column Laravel 5.4

∥☆過路亽.° 提交于 2021-02-10 06:29:46
问题 I'm using the latest Laravel 5.4 I am trying to make a simple query to search users by name. The query written for MySQL looks like this: SELECT * FROM users WHERE upper(name) LIKE '%FOO%'; I'm trying to make it work with Eloquent. Things I've tried but failed: User::where('upper(name)', 'LIKE', '%FOO%')->get() DB::table('users')->where('upper(name)', 'LIKE', '%FOO%')->get() Both fail with the following error: Illuminate\Database\QueryException with message 'SQLSTATE[42S22]: Column not found:

Using 'LIKE' with the result of a SQL subquery

牧云@^-^@ 提交于 2021-02-07 14:37:39
问题 The following query is working absolutely fine for me: SELECT * From Customers WHERE Customers.ContactName = (SELECT FirstName FROM Employees as E, orders as O WHERE <condition> LIMIT 1); However, if i use LIKE instead of = to compare with the result of the subquery, I'm not getting any results. How do I use LIKE '%%' in the above query? 回答1: First, this query should not be working fine: SELECT * From Customers WHERE Customers.ContactName = (SELECT FirstName from Employees as E, orders as O

Using 'LIKE' with the result of a SQL subquery

人走茶凉 提交于 2021-02-07 14:32:01
问题 The following query is working absolutely fine for me: SELECT * From Customers WHERE Customers.ContactName = (SELECT FirstName FROM Employees as E, orders as O WHERE <condition> LIMIT 1); However, if i use LIKE instead of = to compare with the result of the subquery, I'm not getting any results. How do I use LIKE '%%' in the above query? 回答1: First, this query should not be working fine: SELECT * From Customers WHERE Customers.ContactName = (SELECT FirstName from Employees as E, orders as O

Perform a Case insensitive Like query in a case sensitive SQL Server database

混江龙づ霸主 提交于 2021-02-07 13:38:55
问题 This is my scenario. SQL Server 2014 Standard edition, I have a database with a collation SQL_Latin1_General_CP437_BIN2 which is case sensitive. I want to perform a LIKE query which should return the output irrespective of case sensitive. Ex: if i execute a Like query to fetch the records with userName 'John' it should also return rows irrespective of case sensitive 'JOHN', 'John', 'john','joHN'. I tried using Lcase , Ucase , but I am getting the error Msg 195, Level 15, State 10, Line 4