Saturday, August 5, 2023

C# SMO: Unable to get objects by name but able to get by index

Replicating Issue

StoredProcedure sp = db.StoredProcedures["spName"]; // Returns null

Does not return the same as 
StoredProcedure sp = db.StoredProcedures[0]; // Returns object


If I traverse the array (technically a collection), I will find spName. Even if I do:
StoredProcedure sp = db.StoredProcedures[0]; // Returns object
StoredProcedure spByName = db.StoredProcedures[sp.Name]; // returns null


Possible Solution

First I tried. https://www.tek-tips.com/viewthread.cfm?qid=1736324
StoredProcedure storedProcedure =
db.StoredProcedures.Cast<StoredProcedure>().SingleOrDefault(sp => sp.Schema == "YourSchemaName" && sp.Name == "YourSprocName"); 

This worked and this caused me to see that the schema is explicitly entered. After some more research, I could not find how you would provide the schema to the stored procedure name.

Later I tried to look under Database which has a property, DefaultSchema. After setting this, this also returned the correct result.

So the simplest solution:

db.DefaultSchema = "schemaName";
StoredProcedure sp = db.StoredProcedures["spName"]; 

Root Cause Analysis

For my specific case, our DBA changed the default schema of the user. 

Thursday, July 27, 2023

EXCEL: Create new lists of data that contains both (A and B), only A, and only B

 Both

=FILTER(A2:A1019,ISNUMBER(XMATCH(A2:A1019,B2:B1119,0)))


Only A

=FILTER(A2:A1019,ISNA(XMATCH(A2:A1019,B2:B1119,0)))


Only B

=FILTER(B2:B1119,ISNA(XMATCH(B2:B1119,A2:A1019,0)))



Setup

1. Column A includes the data for Table A with a header
2. Column B includes the data for Table B with a header
3. User equation for "Both" in Cell C2
4. User equation for "Only A" in Cell D2
5. User equation for "Only B" in Cell E2
6. Modify data size

Monday, July 24, 2023

Buggish: Microsoft Web Excel keeps clearing out clip board

 Any activity with a cell in the version of Microsoft excel keeps clearing the clipboard. I do a lot of cross-referencing with it and I constantly have to re-copy data.

Any activities like create insert new line, clicking inside a cell, escaping select cell(s), pretty much anything that has to do with a cell will force me to copy from origin again.

This is the global clipboard meaning even if the copied data is not for excel, it is cleared out.

This is quite annoying. This has been going on for a very, very long time. The straw that broke the camel's back was that the cell errored for some reason and I still lost my data.

Not life critical... but extremely frustrating to work around.