I have a question about escape characters for quotes in a select statement.
I know how to do this in PowerShell but not SQL. I have a list of serial numbers from computers.
I would like to search a column based on the last 7 digits of the serial. The best way I know how to do this is with select right
select RIGHT('XYZMN605GMN6',7)
I am trying to run it like so
query....
where <ColumnName> like '%(select RIGHT('XYZMN605GMN6',7))'
This of course formats it all to one string. How can I escape the quotes around the parenthesis so it still runs the select but appends the quotes around it with the wildcard at front? Or maybe there is a better way of doing it I don't know?