SQL checks whether Stored Procedures contain keywords. SQL stored procedures
Select. name from sys. ALL_OBJECTS A, SYS. SQL _MODULES B WHERE. IS_MS_SHIPPED = 0 and. OBJECT_ID = B. OBJECT_ID and. [TYPE] IN ('P', 'V', 'af') AND [DEFINITION] LIKE '%' -- the keyword order by. [NAME] ASC
SQL query problem (query for any keyword in all columns)
According to your requirements, an SQL statement cannot be completed.
You can write dynamic SQL statements or stored procedures only using the database system tables (storing each attribute column of each table.
SQL queries all records whose fields contain a certain keyword
In general, as long as the keyword field and keyword are compared by like, all fields are not compared.
As for "Will it cause the database to refuse execution? There are also efficiency issues. "We suggest you write a stored procedure and execute the storage.
For example:
Go
Create procedure GetKeyWordRecord @ keyWord varchar (20)
As
Set @ keyWord = '%' + @ keyWord + '%'
Select * from your table
Where
Your field 1 like @ keyWord or
Your field 2 like @ keyWord or
Your field 3 like @ keyWord or
Your field 4 like @ keyWord or
Your field 5 like @ keyWord --- more fields are omitted
Go
Exec GetKeyWordRecord 'key'