In MySQL, create a SQL query using the LIKE operator.

Sued21

New Member
Jun 20, 2022
2
0
1
Please keep discussion on topic, i.e. related to Proxmox. This is the second time you asked for help with programming in this forum.
While executing, I receive an error on the % operator. Could you kindly assist me with writing properly?
Code:
SET @sql = N'DELETE TOP(1000) FROM ' + @tableName + ' WHERE ItemId
        in (Select ItemId from dbo.History_Item
            WHERE (
                [FullyQualifiedName] LIKE ''' + @machine_DS + '.%'''
                OR
                [FullyQualifiedName] Like '''+ @machine_Kpi + '.%'''
                )
            )
        AND datetime between'''+ @startDate +''' And '''+ @endDate +'''
I followed this question on how to parameterize query using like operator in SQL Server and read the article Set operators in SQL as a material source, but I couldn't get it to work flawlessly. I realize it's a redundant query, but I'm having difficulties setting it up.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!