Your final select statement, "SELECT @AsOfDateTime_MST" does not give the field a name. SQL Server will return data, but will look like this:
Tableau requires that the field have a name. So you can change it to the following:
SELECT @AsOfDateTime_MST AS As_Of_Date
This will ensure it has a name and Tableau should be okay with it.
If this helps to answer your question, then please be sure to mark this as correct so others searching for similar issues may be able to learn from it. Thanks!
Thanks for the reply Ken. Sorry for the delay. Even when I provide a field name in the SELECT statement, I got the following error when trying to run the following statement using Custom SQL
EXEC dbo.sp_testdatereturn @AsOfDate_MST_parm = '2018-06-01'
I can get to other data sources of SERVER1, so I know that is not the issue. Any other ideas? Thanks!
- [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near the keyword 'EXEC'.
- [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near ')'.
- Unable to connect to the server "SERVER1". Check that the server is running and that you have access privileges to the requested database.
Can you provide the entire Stored Procedure?
Here it is. Thanks.
CREATE PROCEDURE dbo.sp_testdatereturn @AsOfDate_MST_parm date
DECLARE @AsOfDateTime_MST datetime2
SET @AsOfDateTime_MST = CAST(@AsOfDate_MST_parm AS datetime2)
SELECT @AsOfDateTime_MST AS AsOfDateTime_MST
1 of 1 people found this helpful
Instead of using the Custom SQL option to call the stored procedure, do the following:
After connecting to the database, instead of creating a custom SQL, look at the bottom section and you'll see Stored Procedures.
Drag over the SP and you'll get a popup box asking for your parameters
Enter the value and click OK.
You should now be able to see your data
Hi, just following up on this to see if we've addressed your question or you have additional questions. Please advise.
Thanks Ken! This worked, sorry about the delayed reply.
No worries. Thanks Mike!