Tableau, send parameter to query - sql-server

i work with text table in tableau and i want to be able to click on a cell in the table, so that the value of the cell would be transfered\sent to sql query or procedure, does anyone know if this is possible?
if not, is there a way i could define a column in a text table as a parameter with multiple values?
Thanks

Yes it is possible if you use a custom sql option. once you connect to your DB/DS select custom sql and then pass your variable through tableau parameter.

Related

Querying Column Name as Variable Using Tableau Custom SQL

I am building a lookup tool that will take Column Name and Table Name as inputs from Tableau as Parameters, and plug those in to Tableau Custom SQL as Parameter values, but I cannot find a way to make the Column Name dynamic in the select query.
Here is the idea:
Select ParameterColumnName
FROM TABLE(ParameterTableName)
I have investigated Snowflake's "IDENTIFIER" commands, but those seem to work only in the FROM clause of the query. I have tested with a static column name and dynamic table name and that works fine.
I have also explored setting variables with the parameter column name values, but I cannot seem to use "SET" in Tableau Custom SQL--it does not recognize SET. Appreciate any pointers.
Update: This post appears to address why I cannot set variables from Custom SQL, but if that's not it, let me know!

How can I write a spark dataframe to an existing SQL Server table?

I want to use a spark job to pull data from a hive table and then insert it into an existing SQL Server table, flush-and-fill style.
I was planning on using df.write.jdbc(), however it seems this method has no way to pass in a SaveMode.Overwrite parameter. At the moment, the SaveMode is ErrorIfExists.
How can I get around this?
You can try by this
df.write.mode("overwrite").jdbc()
There is a way to truncate the target table but it's not supported by all SQL Server JDBCs (from my experience). As you can see on the code below, you can set the mode as "overwrite" and later the option "truncate" as true (where prop are the additional properties to set
spark.range(10).write.mode("overwrite").option("truncate", true).jdbc(url, "table", prop)
Another format for the same is
df.write.option("truncate", "true").jdbc(url=DATABASE_URL, table=DATABASE_TABLE, mode="overwrite", properties=DATABASE_PROPERTIES)

Running Sql server Stored Procedure with excel parameter and without using VBA

I would like to excecute an sql server stored procedure with a date parameter from excel, the date parameter is an input in a cell of the spreadsheet.
Is it possible to do this without using VBA ?
My goal is to get dynamic results every time when i set a new date value in the excel file and the examples that i found are using vba when it is about using the dynamic parameters from the excel file.
Please help if there is a way to do that without vba.
Thanks in advance
Yes.
Start by using Microsoft query to set up a connection to your database, and as the desired number of parameters... Parameters can be added by putting conditions on the query and entering [] in the value box.
Finish creating the connection then edit the connection, and change the SQL to:
Dbo.procedurename ?
The question mark is placeholder for parameters. Link the parameter to cell, and set it to auto update on cell change and your good to go.

Update microsoft excel single cell to database

i already pull data from sql server, with 2 blank column.
my requirement is :
when user enter value into a single cell in these 2 columns, it will update database base on primary key (specific column's value in same row).
would it able to do like this?
Thanks a lot!
If updating cell by cell is really a requirement, I suggest you create a procedure in SQL Server that accepts the cell value as a parameter. However, it would probably be better to wait until all relevant cells have been completed and ask the user to click a button to update. You will need to do a good deal of checking to ensure that data is not sent twice. It is also possible to work from the SQL server end.

Changing multiple values in an XML column in SQL Server 2008

I've got a column in a SQL Server table that is type XML. I want to change multiple values in the XML in a stored proc. I've already found the XML.Modify(...) command and have it working for a single value. Can I change multiple values in the XML in one update command or do I need to do it as multuple update commands?
You will need to use multiple (xmlcol).modify calls - you cannot update multiple bits at once, as far as I know.

Resources