I manage a handful of queries that run against a production environment that is managed by a vendor and I have read-only access. This server is the production environment for activity that happens on a specific kind of machine. We'll call this System A.
I also have another production environment managed by another vendor that I also have read-only access to. This environment contains, among a lot of things, other important details about the machines from System A. We'll call this System B.
I use scheduled tasks and Powershell to run the queries against System A to produce a variety of fixed width files.
A mapping table is required that combines Machines from System A and details about said Machine from System B. I put 'table' in quotes because it's not really a table as much as it is a manual select script.
My solution so far has been to use a CTE with UNION selects and hard coded values, like so:
With MachineMapping (MachineName, Value1, Value2) as ( SELECT 'MachineA', 'Text', 'Text') UNION SELECT 'MachineB', 'Text', 'Text') )
This CTE is now 50+ selects and growing as well as changing in some cases. Anytime details about a machine are added or change I need to manually add to that CTE and maintain it across all 10+ queries. Not only is this time consuming, it's really error prone.
My question to everyone is: Is there a better way to do this, given my read-only restrictions?
EDIT: A little more clarity.. I want to avoid having to build (and maintain) the MachineMapping CTE in every single script I run while also not being able to create a real table in the DB.
So hey I'm new and I'm currently 17f. I'm in my final year of high school and I've got finals coming up early next year. All my schooling years, English has been the only subject that I always score an A+ in. I love languages and science. Lately due to some teen depression, bulimia and other stuff my life has been a whirlwind.
Despite my family trying to get me interested in other things like art, sports or the field of medicine, I still can't imagine life working a day to day job boringly. My dad wants me to take over his pharmaceutical business but the thing is my grades aren't qualifying enough for it especially in futher Mathematics. I've tried to tell them that no matter what I want to become a writer but no one understands me. They legit have no belief that I'll succeed and everytime I show my dad any narrative essays I've written he just doesn't seem to care.
My English teachers have said that I am talented in writing compared to my peers. I have a wide imagination and I often get spaced out or end up daydreaming about another reality that is better than the current one I'm living. My teachers often school me and my friends call me the blur face cause I don't understand other things but I dominate the class during language lessons.
I dream of writing dystopian novels, romance stories or even erotic fiction. I just love writing and it's just a way I get to express my emotions and thoughts. But honestly I'm not sure if I'll actually be able to make it especially coming from a conservative Muslim country erotic novels are seen as taboo. My family prefers to mock me and force me to become what they please.
I plan to try writing after my finals in January next year. Since I'm not brave enough to escape my generational curses, I might just study a degree in pharmacy even though I legit have zero interest in it but is possible for me to write while studying or would it be tough?
Any advice or suggestions on how deal with this and if I start a career in writing how do I start?
"Give yourself permission to be bad", "Skip ahead", and "No matter what, write X amount of words per day" are also non-answers I've heard a million billion times. No matter what I put down onto the page it never sticks, it always strays from the topic at hand, and I end up having to trim it. Does this happen to anyone else? Have I really just hit one motherfucker of a block?
I have a DB for which there is an auto_increment Primary Key, I can see how records get correctly inserted and from time to time, there is one that gets deleted (I cannot see it anymore in the table).
From looking at the replication being done, I am missing deletes. Once I go to the binary logs and scan through them I can see INSERT statements fine, but I find no DELETEs.
I have no access to the web application that writes to the MySQL DB, and I can only see (connect to) the DB instance which is a GCP Cloud MySQL.
Note: The question-taker's husband's replies may not have been all recorded.
|The pain scale speaks to us at r/endo in a special way. Knowing that you yourself have suffered it, I just wanted to thank you for helping us find more accurate ways to describe what's happening as we sob to our doctors. Wishing you good health in the future!||Shout out to my endo peeps! That's one of the things that almost killed me (stage IV, hemorrhaging, had a hysterectomy at 27), and I feel a sort of poetic satisfaction knowing that something I made has helped my fellow sufferers deal with this hell of a medical condition.|
|Wishes of good health back at you, sisterfriend!|
|^(the below is a reply to the above)|
I had no idea you suffered with endo! Looking back to when I was a teenager reading your blogs it was a huge source of comfort finding an escape from the endo pain because no one believed how bad it was until I had my second lap in 2015 (age 22). They found stage II endo hanging out on my bowels and literally everywhere else, not to mention an ovarian cyst that twisted my fallopian tube shut as it grew! Another doc found ureaplasma growing for God knows how long but it had reached up to my liver and I needed 14 days of antibiotics to get rid of it, and that shit causes infertility if left untreated. My excision surgery was last December and they finally found some pelvic congestion syndrome, too (vericose veins on my ovaries, so like all of the internal tissue is engorged and purple which is equal parts disgusting and painful) and on top of that I still deal with overactive muscle spasms from dealing with chronic pain for so long. Also, I have passed over 60 kidney stones, I have a gluten intolerance, I'm wildly allergic to pork, and I'm being tested again for MS. My organs are always mad at me. So was it the hemorraging that finally convinced the doctors to give you a hysterectomy? Did you have to have your ex-husband bargain with the doctors and sign in blood that your own reproductive organs that were trying to kill you were good to be removed per his request? Or did you have a nice doctor that actually cared that you lived and had some semblance of quality of life? Also, did you grieve at all for not being able to carry babies? At this point I'd r... keep reading on reddit ➡
Hi - I am very new to SQL (programming in general) and was asked to write a store procedure to purge data on a temporal table that is greater then a year old.
I have a few questions:
If the script is written to deletes records who’s sysstartdate is more than a year old, will this also effect records that have been unchanged? For example let’s say a certain row has been unchanged for two years, the script sees the Sysstartdate as greater then a year old I’m assuming it will deletes it on temporal table, does this have an impact on reverting?
I’m wrapping the delete statement in a transaction and from my research some people are using DELETE table WITH (TABLOCKX). Can someone help me understand why we would use TABLOCKX here and the pros/cons?
Thank you reddit
guys, I have a problem exposing Matlab data to SQL Server. When I load data from an Excel spreadsheet the data appears correctly, with ç â and accents.
However, when I export from Matlab to SQL the data recorded in SQL is messed up as shown in the following screen
what should i do to solve this problem?
Hi, I usually write long research documents where it has multiple links to other documents. Some times they have links to excel files. I could create hyperlinks to such documents, but I want the link to open exact specific section of the file. Some of my research is also present in pdf, word documents. I also write a lot of my thoughts in Evernote on the go. I would like to give exact line of the Evernote in my final document as well.
I was wondering if you are using any software to achieve such desired result.
Thank you for your help.
I am writing a paper finding out whether the prevalence of a previous papers data is significantly different than mine. I have spss and can figure out how to do any stats test needed. im fairly capable I would say but for some reason I cant figure out this bungle in my research.
the data looks something similar below:
|Data source||Anomaly 1||Anomaly 2|
|Previous paper (n= 345)||45% (CI .175-.933)||55% (CI .165-.343)|
|my data (n=208)||56%||44%|
I only have the previous papers data (row 1 of this table) and thats all the information I have....anythoughts if I can compare my data to theirs? I can get my confidence interval easy I already calculated it.
Appreciate the help.
|^(the below has been split into four)|
|Hi Allie! I have a couple questions and not a lot of tact. I also have a lot of gratitude for you because you've been a (a, itself, or a source of, whichever) tether more than once, so thanks! 1. How are you handling all this everything since you announced your aliveness publicly?||Thank you for asking these! They're great questions! I'm doing better than I thought I'd be doing at this point, so that's good. Having trouble sleeping sometimes because I get too amped up, and my hiding instincts start come on strong, but overall it has been a pleasant, interesting experience. You guys are very kind and understanding toward me, and I feel tremendous gratitude for that.|
|2. You talk about trying and keep on keeping on quite a bit - my longest relationship has been with depression, and while I'm not suicidal, I'm often just tired, so I have to ask... how do you keep up with trying? I've been considering pure spite, but I'm super open to other options.||This is a particularly good question, and I'm still kind of trying to answer it myself, but I think, at some point, it became clear that trying was the only logical action I could take from the position I was in. Because if I don't try, my situation is left completely up to chance, and it may never improve. Will I succeed? Who knows! Trying is the only guarantee. It's the only strategy I can rely on pretty much no matter what (because it doesn't depend on results—the process itself counts, and it can be modified and improved constantly). That being said, trying can be exhausting. And it can be frustrating. And it doesn't always feel very rewarding, so I have to try to create that sense of reward for myself. One thing I've been doing recently is pausing to internally celebrate my little, invisible personal victories. I'm usually the only one who could understand how hard they were, so it's my job to recognize the effort. If I did something hard—and I mean that relatively, because there are a lot of things that are hard for me that aren't necessarily hard for others—I take a moment to recognize my efforts. Yeah, it was fucking UNBELIEVABLY hard to summon the willpower to walk to the mailbox today. Good job, me for doing it anyway! That kind of thing.|
|3. Can you please elaborate on the simple dog? Specifically, is the simple dog simply a strange dog, or does the simple dog have a diagnosis?||The simple dog was neve|
How do I check if node exist before writing into table? I don’t want to read first and check. Can I apply rule on the table?
One day after a party I found something that looks like a part of a table from some sculpture or something. I have no idea who could have brought this or where it came from, i can read 3 lines from it: "?sofia fa??as sculptor"(? =unknown letter")
"existed s world in wich"
"magical creatures among"
"have now returned"