When connecting to a MS SQL Server stored procedure, the following error message may appear:
[Microsoft][SQL Server Native Client] Invalid cursor state.
Stored Procedures can return anything. This can prove problematic for Tableau where a data source should have a static schema. Tableau Desktop will end up with the Invalid Cursor state error when stored procedures do not return any result set. This can be tested by running exec dbo.<sproc name> <parameters> in a third party tool such as SQL Management Studio. If the command runs with no results tab expect to receive an Invalid Cursor State error in Tableau Desktop.
Ensure that the stored procedure is returning a result set. The best stored procedure structure is one that defines the return table, inserts data into that table, and returns that table at the end of the procedure. This ensures a consistent returned schema and one that always returns a result set to Tableau Desktop.
Also see:
001473076

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.