-
Hi, Basically, the initial target what I wanted to achieve was to display Datagrid component and fill it with SQL data as description. I wanted to have there 4 columns each having its title and the description of each would be a number as a result of SQL query. select
'table' as component;
IF EXISTS (
SELECT * FROM TalkgroupManipulationLocks
)
BEGIN
SELECT '1'
END
ELSE
BEGIN
SELECT '0'
END; The table component is there for debugging purposes only. I got back sqlparser error: Did my test prove that SQL parser searches only for SELECT statements and does not support IF / ELSE statements or am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hello! Indeed, top-level each statements are not supported. But in your case it sounds like you can use a simple standard case expression, or even a coalesce statement with a subquery: |
Beta Was this translation helpful? Give feedback.
-
If you post your query that returned zero rows here, we may be able to help you change it to return a single NULL value instead when there is no data. Here is an example of datagrid with real data: https://replit.com/@pimaj62145/SQLPage-datagrid-with-fallback#index.sql |
Beta Was this translation helpful? Give feedback.
-
I tested your code and it works. It shows me dash when no rows are returned which is OK.
|
Beta Was this translation helpful? Give feedback.
It looks like what you need is just
right ?
https://sqlfiddle.com/sql-server/online-compiler?id=9a919ccf-3309-4112-b828-389c4705b0e8