SQuirrel - Prevent multiple result tabs - squirrel-sql

I am using SQuirrel SQL Client Version 3.5 and everytime I modify and run a query it opens up a new result tab. I would prefer that it re-use the existing result tab (replacing the contents) Is there a way to do this?

Another way to do this (without having to set the sticky flag everytime) is to set the maximum limit of SQL Result Tabs to 1 in the Global New Session Properties.
You'll find it here: File --> New Session Properties --> SQL Tab

Right click on a result tab and select sticky. This prevents new result tabs from opening.

Related

SSIS - Loop Through Active Directory

Disclaimer: new to SSIS and Active Directory
I have a need to extract all users within a particular Active Directory (AD) domain and import them into Excel. I have followed this: https://www.itnota.com/query-ldap-in-visual-studio-ssis/ in order to create my SSIS package. My SQL is:
LDAP://DC=JOHN,DC=JANE,DC=DOE;(&(objectCategory=person)(objectClass=user)(name=a*));Name,sAMAccountName
As you know there is a 1,000 row limit when pulling from the AD. In my SQL I currently have (name=a*) to test the process and it works. I need to know how to setup a loop with variables to pull all records and import into Excel (or whatever you experts recommend). Also, how do I know what the other field names are that are available to pull?
Thanks in advance.
How do I see what's in Active Directory
Tool recommendations are off topic for the site but a tool that you can download, no install required, is AD Explorer It's a MS tool that allows you to view your domain. Highly recommend people that need to see what's in AD use something like this as it shows you your basic structure.
What's my domain controller?
Start -> Command Prompt
Type set | find /i "userdnsdomain" and look for USERDNSDOMAIN and put that value in the connect dialog and I save it because I don't want to enter this every time.
Search/Find and then look yourself up. Here I'm going to find my account by using my sAMAccountName
The search results show only one user but there could have been multiples since I did a contains relationship.
Double clicking the value in the bottom results section causes the under pane window to update with the details of the search result.
This is nice because while the right side shows all the properties associated to my account, it's also updated the left pane to navigate to the CN. In my case it's CN=Users but again, it could be something else in your specific environment.
You might discover an interesting categorization for your particular domain. At a very large client, I discovered that my target users were all under a CN
(Canonical Name, I think) so I could use that in my AD query.
There are things you'll see here that you sure would like to bring into a data flow but you won't be able to. Like the memberOf that's a complex type and there's no equivalent in the data flow data types for it. I think Integer8 is also something that didn't work.
Loop the loop
The "trick" here is that we'll need to take advantage of the
The name of the AD provider has changed since I last looked at this. In VS 2017, I see the OLE DB Provider name as "OLE DB Provider for Microsoft Directory Service"
Put in your query and you should get results back. Let that happen so the metadata is set.
An ADO.NET source does not support parameterization as the OLE DB does. However, you can apply an Expression on the Data Flow which surfaces the component and that's what we'll do.
Click out of the Data Flow and back into the Control Flow and right click on the Data Flow and select Properties. In that properties window, find Expressions and click the ellipses ... Up pops the Property Expressions Editor
Find the ADO.NET source under Property and in the Expressions section, click the Ellipses.
Here, we'll use your same source query just to prove we're doing the right things
"LDAP://DC=JOHN,DC=JANE,DC=DOE;(&(objectCategory=person)(objectClass=user)(name=" + "a" + "*));Name,sAMAccountName"
We're doing string building here so the problem we're left to solve is how we can substitute something for the "a" in the above query.
The laziest route would be to
Create an SSIS variable of type String called CurrentLetter and initialize it to a
Update the expression we just created to be "LDAP://DC=JOHN,DC=JANE,DC=DOE;(&(objectCategory=person)(objectClass=user)(name=" + #[USer::CurrentLetter] + "*));Name,sAMAccountName"
Add a Foreach Loop Container (FELC) to your Control Flow.
Configure the FELC with an enumerator of "Foreach Item Enumerator"
Click the Columns...
Click Add (this results in Column 0 with data type String) so click OK
Fill the collection with each letter of the alphabet
In the Variable Mappings tab, assign Variable User::CurrentLetter to Index 0
Click OK
Old blog posts on the matter because I like clicks
https://billfellows.blogspot.com/2011/04/active-directory-ssis-data-source.html
http://billfellows.blogspot.com/2013/11/biml-active-directory-ssis-data-source.html

EXCEL How to change the REST URL based on the cell parameters

I created a web query as below in Excel.
New Queries --> From Other Sources --> From Web
How do I pass in the cell value as a parameter to the Url?
I have search bunch of articles, including in the stackoverflow. None of them work.
There is 1 article says I can do this in VBA.
ThisWorkbook.Sheets("[SheetName]").QueryTables("[TableName]").Connection =
But it is not there.
Any one know how to do this?
More information:
It is connecting to a REST server, and geting back the JSON result.
I found an article discussing how to create a query link mine, but it has not options to add the parameters. Please see the link. Step 3 have the URL typed in.
https://success.planview.com/Planview_LeanKit/Reporting/Advanced_Reporting/030Configure_A_Connection_To_The_Reporting_API_With_Excel
Give the cell a name, e.g. pMyParameter.
Open the query editor and create a new blank query (New Query --> Other Sources --> Blank Query). Give that query a name similar (or same) to the cell name (let's call it pMyParameterQuery). Open the Advanced Editor and replace everything with the following.
let
Source = Excel.CurrentWorkbook(){[Name="pMyParameter"]}[Content]{0}[Column1]
in
Source
You'll see in the query list that this query does not return a table but text (or a number / date / ... depending on the contents of your named cell).
Now switch to your web query and open its Advanced Editor. Find the line that has the URL, probably something like this:
Source = Web.Page(Web.Contents("http://www.example.com?someParameter=someValue")),
Here you can use the result of the parameter-query in the URL like this:
Source = Web.Page(Web.Contents("http://www.example.com?someParameter=" & pMyParameterQuery)),

How does one view the SQL query that a button fires in Access?

There is an existing Access program that I need to learn more about. There is a button in the program that, when pressed, outputs an Excel file. It queries some tables within it for the data.
How would I view the raw SQL code that this button utilizes to generate this Excel file? From the button's properties, I can see that its On Click event is "[Embedded Macro]". Also, it's object type is "Query".
Thank you in advance.
In the On Click row (under the Event tab in Properties), when I click on the ellipse next to "[Embedded Macro]", I am presented with an expandable section containing these rows:
Object Type - Query
Object Name - Inv File Query
Output Format - Excel Workbook (*.xlsx)
Output File - (blank)
Auto Start - No
Template File - (blank)
Encoding - (blank)
Output Quality - Print
I don't see any logic (SQL, VBA, etc.) listed anywhere, however, as to how Access will construct this Excel file that it exports. How would I view this logic? I figure this logic has to be stored somewhere because the button does actually return an Excel file populated with data.
You have the name of the query used here.
The SQL thus used is in a query called Inv File Query.
So you need to display the query objects in the nav pane (assuming 2007 onwards).
So choose this:
And then all of the queries used in the application will display. If the query Inv File Query does not show, it may be hidden. (to be fair, I would choose All Access objects - but for this we choose query). And hit F11 if the nav pane does not show.
If for some reason you STILL do not see the query, then you want to display hidden objects.
To display all hidden objects then right click on the top part of the nav pane (on the query) like this:
Then:
Turn all of the options, and now you should be able to see/view the SQL used for the query called Inv File Query
Open the form in Design view
Open the Properties sheet by right-clicking on the button and choosing "Properties".
In the On Click event, where you see "[Embedded Macro]", click on the ellipse on the far right
As a pointer, once you've figured out what's going on, I'd do my best to convert it all to VBA code. This will eliminate confusion in the future, and macros are really the poor man's way out of writing code anyway. I never, ever use macros in my Access apps.

BusinessObjects - Changing Syntax in Generating Query

When I make a query in BusinessObjects and when two tables are inner-joined, the BO generates the following script:
SELECT
attr_1,... attr_N
FROM Table_1, Table_2
WHERE Table_1.key = Table_2.key
Is it possible to set BusinessObjets to generate queries in the following format:
SELECT
attr_1,..., attr_N
FROM Table_1
INNER JOIN
Table_2
ON Table_1.key = Table_2.key
When I want to check the query, it is much more easy to read the syntax in the second example.
Btw, I tried to modify some parameters. However, it didn't work.
Any suggestion on how to do it quickly and easily?
Assuming you're on XI3...
In Designer, go to File -> Parameters. Then click the Parameter tab. In there you should see a parameter named "ANSI92"; change its value to Yes and click Replace.
In BI4 IDT, first open the universe's Data Foundation. Then click on the .dfx file in the Data Foundation pane to select it:
This will bring up the Data Foundation settings in the lower right corner of the window. Click the Properties tab, then the Parameters button:
In the dialog that comes up, you can change the ANSI92 option:

Problem with the row count transform

I currently deployed an SSIS package (Developed on the 2005 version) (developed on my local server) in a pre production environment for testing. I have used the Row count transform to get a count of good/bad records. It works fine on my local system . However when i deploy this on the pre prod server, the row count does not work! (as in it does not recognize the vairbales i have assigned to the relevant transofm - no drop down abvaliable in the variables attribute part. tried deleting and adding a new transoform.. no luck.
Strangely this does not work for any of the other packages also present/deployed on the same server (tried this out by dropping an rc tramsform onto an existing package... same problem)
Any suggestions?
Thanks a tonne
If you are having problem with the row count transform, another alternative that we use here at my company is creating a script component and incrementing a rowcnt variable by one. The performance is just as good-just add this code:
Public Overrides Sub PostExecute()
MyBase.PostExecute()
Me.Variables.rowcnt = Me.Variables.rowcnt + 1
End Sub
This certainly seems odd. Are you saying that when you are in the Advanced Editor for Row Count, under Custom Properties, that the drop down beside VariableName has no options? You should at least see all of the System:: variables.
If the User:: variables are not listed, my first suspicion is that they do not have the correct scope to be visible in the Data Flow Task where you have your RowCount.
When you go up to the Control Flow, and get the Variables list, do you see your user variable there? What is the scope of it?
Note that I recognize that none of this fits with "it works locally but doesn't work when copied to the server", but it is at least where I would start...