Open without result set
Posted: Mon 16 Feb 2009 08:56
Hi,
I have problem with TMSQuery.Open x Execute. I have for example this script:
DBCC CHECKDB (MyTestDB) WITH NO_INFOMSGS, TABLERESULTS
or
IF OBJECT_ID('dbo.ep_DF01','P')IS NOT NULL
BEGIN
EXEC dbo.ep_DF01 1, 'xxx', 2 -- it returns some SELECT
END
In both cases I need to run script with Open, because I expected result set in some cases. But it is possible that it will return no result set and it such case I get error message 'Query must return exactly one result set - use Execute'. I need to call Open and I cannot check all my scripts in the whole application (~2.000.000 rows).
What I can do it? Our old component for SQL Server said RecordCount = 0 (or IsEmpty = True) in case to return no result set...
Thanks a lot
Roman
I have problem with TMSQuery.Open x Execute. I have for example this script:
DBCC CHECKDB (MyTestDB) WITH NO_INFOMSGS, TABLERESULTS
or
IF OBJECT_ID('dbo.ep_DF01','P')IS NOT NULL
BEGIN
EXEC dbo.ep_DF01 1, 'xxx', 2 -- it returns some SELECT
END
In both cases I need to run script with Open, because I expected result set in some cases. But it is possible that it will return no result set and it such case I get error message 'Query must return exactly one result set - use Execute'. I need to call Open and I cannot check all my scripts in the whole application (~2.000.000 rows).
What I can do it? Our old component for SQL Server said RecordCount = 0 (or IsEmpty = True) in case to return no result set...
Thanks a lot
Roman