Skip to main content

Hi,


I can create item working in SQL Server.

Creating item with column values in (monday.com) is also working.

However, when I try to create item with column values in SQL, it is not working. I have tried many kind of parenthesis for the text. None of them work.


Please see below.


–Working. Below query is working

SET @query = ‘{“query”: "mutation {create_item (board_id: 3791969201, group_id: "new_group16869", item_name: "new item 91") {id }} " }’


–Not working. Below query is not working when I added the column values array

SET @query = ‘{“query”: “mutation {create_item (board_id: 3791969201, group_id: "new_group16869", item_name: "new item 11", column_values: “{ "text" : "test_value" }” ) {id}}”}’


EXEC @hr = sp_OACreate ‘MSXML2.ServerXMLHttp’, @Object OUT

EXEC @hr = sp_OAMethod @Object, ‘open’, NULL, ‘POST’, @Url, false

EXEC @hr = sp_OAMethod @Object, ‘setRequestHeader’, NULL, ‘Authorization’, ‘xxxxx’

EXEC @hr = sp_OAMethod @Object, ‘setRequestHeader’, NULL, ‘Content-Type’, ‘application/json’

EXEC @hr = sp_OAMethod @Object, ‘send’, NULL, @query out

EXEC @hr = sp_OAGetProperty @Object, ‘responseText’, @response OUT




Below is working in monday.com


mutation {

create_item(board_id: 3791969201,

group_id: “new_group16869”,

item_name: “new item 13”,

column_values: “{"text" : "test_value", "text6" : "value2"}”) {

id

}

}


Please help with this. I need to get this working in SQL


Thank you.

Hello @aow,


What error are you getting?


I don’t have lots of experience with SQL, having said that, you might need to escape outer quotes when using column_values.


Could you try:

SET @query = '{"query": "mutation {create_item (board_id: 3791969201, group_id: "new_group16869", item_name: "new item 11", column_values: "{\\"text\\" : \\"test_value\\" }" ) {id}}"}'


Let me know what happens!


Cheers,

Matias


Reply