Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
mikecrengland
Creator III
Creator III

Select @@SERVERNAME

Hello All -

Our DBAs are suspicious of a connection string that we are using in our scripts. They asked if I could run Select @@SERVERNAME  to verify the connection, but I'm not sure how to make it work or if it's possible.

Any ideas?

Thanks!

Mike

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

If SELECT * FROM table does not work, there is definitely an issue with the permissions in the user that QlikView has n the connection string or the one defined in the DSN. If you cannot run queries with that user, then I don't know how else you can provide any useful data. They can see which IP is connecting the server, if that matches with Production server you are hitting then Production.

While LOAD is always a good idea, for this test there is no need to use it.

View solution in original post

6 Replies
Miguel_Angel_Baeyens

Yes, you can do that in the script, for example. If the driver supports that, that will return a field with the servername.

mikecrengland
Creator III
Creator III
Author

Thanks, Miguel. But I guess I'm doing something wrong.

I simply have the connection string, then:

@@SERVERNAME;

But get an error:

OLEDB read failed

Select @@SERVERNAME

The driver is:

Provider=SQLOLEDB

Do you see anything there that would make it fail?

mike

Miguel_Angel_Baeyens

If you do any SELECT * FROM table does it work? (A simple one just to test that the connection is OK)

Has the user permissions to check that variable (i.e.: logging in as that user in SQL and selecting, does it return anything)?

mikecrengland
Creator III
Creator III
Author

SELECT * FROM table does work. I used the command from SQL Management Studio and it worked.


The database that we think we're hitting is a replicated reporting DB, but the DBAs seem to think it's hitting production. So they asked me to do this to prove it one way or the other...


Would it need some LOAD statement before the @@SERVERNAME ?

Miguel_Angel_Baeyens

If SELECT * FROM table does not work, there is definitely an issue with the permissions in the user that QlikView has n the connection string or the one defined in the DSN. If you cannot run queries with that user, then I don't know how else you can provide any useful data. They can see which IP is connecting the server, if that matches with Production server you are hitting then Production.

While LOAD is always a good idea, for this test there is no need to use it.

mikecrengland
Creator III
Creator III
Author

Thanks!