Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 975
Kurkula Avatar asked Nov 29 '22 14:11

Kurkula


2 Answers

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
like image 66
Chief Wiggum Avatar answered Dec 28 '22 23:12

Chief Wiggum


You should use single quotes '(and escape those that are in your string with backslash \), because now you are assigning Query to the identifier (in that case, column name) and if it was even the right size for the identifier, you would probably get error like invalid column name :

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
like image 20
potashin Avatar answered Dec 29 '22 01:12

potashin