Get one linked server property - tsql

I use SQL Server 2014, I also have a linked SQL Server configured on it, and I need to get a particular linked server property via TSQL. The property is 'remote proc transaction promotion'. I set this option through the next code
EXEC sp_serveroption 'LinkedServer', 'remote proc transaction promotion', 'FALSE'
but I do not know how I can read the value of this option via T-SQL. Any help is appreciated.

The sys.servers system catalog view has a record for each registered linked or remote (for backward compatibility) server. The is_remote_proc_transaction_promotion_enabled column corresponds to the remote proc transaction promotion option of the sp_serveroption stored procedure. This column is of the bit data type, with true represented by 1 and false by 0.
select is_remote_proc_transaction_promotion_enabled from sys.servers where name = 'LinkedServer'

Related

How to connect to Sp from Tableau?

I have SP's written in SQL server. When i connect to Tableau I have to use these SPs. How to pass values to SP in tableau?
Any help about this concern is appreciated.
http://onlinehelp.tableau.com/current/pro/desktop/en-us/connect_basic_stored_procedures.html
Basically, you add the stored procedure into the data source and then you create parameters in tableau and use them to execute the stored procedure.
From the left pane, drag the procedure to the canvas or double-click
one of the listed procedures. If parameters are available in the
procedure, the Parameters dialog box automatically displays. Instead
of entering a value, you can use an existing Tableau parameter, or
create a new Tableau parameter for the value:
If you then expose the Tableau parameter in the view, users are able
to change the value of the parameter in the procedure interactively.

Datastage: set web server trasformer stage url from query

I need to set "PortAddress" and "WSDL Address" dinamically using the result of a query.
I've created the oracle Connector stage with my query. For example:
select col1,col2,col3,...,url
from myTable
How can I use "url" column value in the Web Service stage?
Thanks in advance.
This is a general problem not restricted to your web service transformer. You want to "transfer" data from a data stream to the Sequence level in order to feed it into the next job as a parameter.
Basically there are two main ways to do it:
Parallel Edition: In the first job where select the url from your database and write it to a value file of a parameter set. Use the parameter set in the second job with the new value file. Details see here
Server Edition: In a server job you select the data from your database in a transformer you can use a DataStage function (DSSetUserStatus) to set the so called UserStatus for this job. This can then be referenced in the next job of the Sequence.

TSQL sysdatabases query returns 'Server Name'

I use the following query:
select name from sys.sysdatabases
and get an additional column returned called Server Name
Where does this column come from, as it is a handy column to have in ssrs but will not replicate, it only works in Management Studio
What Probably Happened
My guess is that you opened your query window by right-clicking on a registered server group and choosing "New Query."
Microsoft SQL Server Management Studio (SSMS) offers a feature where it will run the same query on multiple servers and then combine the results into a single results grid. To help you sort out which server returned which data rows, by default SSMS adds a Server Name column to this grid. This feature can be accessed by first adding the servers of interest to the registered servers list and then right-clicking on the relevant registered server group and choosing "New Query."
How to Achieve the Same Effect in SSMS
Depending on the exact data you want, you can get the executing server's name via the T-SQL variable ##SERVERNAME or the SERVERNAME property of the SERVERPROPERTY function (see the remarks section of MSDN's documentation on SERVERPROPERTY for details on the difference between what these two approaches retrun).
For example, if you choose to use##SERVERNAME, you can fetch that name via a stand-alone query (SELECT ##SERVERNAME). You can also achieve functionality similar to SSMS's Server Name column by adding , 'Server Name' = ##SERVERNAME to the end of your SSRS report's SELECT column list (e.g. SELECT FirstName, LastName, 'Server Name' = ##SERVERNAME FROM ....).

How to check if SQL Server 2008R2 merge pull subscription is set to reinitialize?

I am using RMO and some T-SQL to manage my subscriptions and have a need to know if a subscription has been set to reinitialize on next sync.
As far as I know, you can query the table sysmergesubscriptions on the server and check the column sentgen for your subscriber. If it is NULL, it has been marked for reinitialization.
Publisher: SQL Server 2016 Standard
Subscriber: SQL Server 2012 Express
Subscription Type: Merge Pull
The columns schemaversion & schemaguid are set to NULL when a subscription is marked for reinitialization. schemaversion is set to -1 when it's syncing after marked as reinitialization.
SELECT db_name, subscriber_server, schemaversion, schemaguid FROM sysmergesubscriptions

Using Entity Framework how can i find out when the last change was made to a table?

Is there a quick way to find out when last change took place in some table?
EDIT:
I realize that i can add a column which will hold a change date, but i am wondering if there is some kind of metadata that can be accessed by EF. My db is hosted on SQL Server 2008.
Add a 'last updated' column to your table and query that one for the latest change.
Update: If that is not an option as per the update to the question, you could:
a) create a separate db table with table name and date/time and update that one with triggers on the table you want to track.
...or...
b) since you're using SQL Server 2008 you could possibly do something with SQL Server change tracking. There's no built-in support for change tracking in EF, but that doesn't prevent you from using it 'on the side'...