Sql Query throws Identifier is too long. Maximum length is 128

sqlsql serversql-update

I am working on a simple update query and i see the below error while executing query. I am very much clear that this should not be a length issue at all. What may be the problem.

Error:

The identifier that starts with identifier is too long. Maximum length is 128

My Query:

update dbo.DataSettings set 
Query ="/Details?$filter=(Status ne 'yes' and Status ne 'ok')&$expand=name,Address/street,phone/mobile&$orderby=details/Id desc"
where id=5

Best Answer

Use single quotes and escape your quotes in the text with two single quotes:

update dbo.DataSettings set
set Query= '/Details?$filter=(Status ne ''yes'' and Status ne ''ok'')&$expand=name,Address/street,phone/mobile&$orderby=details/Id desc'
where id=5
Related Topic