I am trying to execute as certain xp_cmdshell code: but this is the error that I get: when I try an execute the same thing in powershell I get the expected response(see image) Powershell The expected output from the xp_cmdshell should be a json Answer The error message implies that your command line is being …
Tag: sql
SQL Join with partial string match
I have a table ‘TableA’ like: Another table ‘TableB’ like: I am using INNER JOIN between two tables like: I want to add another condition for join, which looks for value of ‘Group’ in ‘Subgroup’ and only joins if the ‘Group’ Value matches after ̵…
How to select records with a combination of values exist between two tables
I cannot figure this one out, I want to check these two tables, where ALL LadReady are ‘Shi’ for a given LadSeries. This query is almost there… but 410 should not be in the results because there is clearly one record where LadReady is ‘Yes’ instead of ‘Shi’. Query: Ta…
Query monitoring changes in the field
I need to program a query where I can see the changes that certain fields have undergone in a certain date period. Example: From the CAM_CONCEN table bring those records where the ACCOUNT_NUMBER undergoes a modification in the CONCTACT field in a period of 6 months before the date. I would be grateful if you …
Changing a column value to several records in a consecutive fashion using clever statements in SQL
I have a Postgres table that has an order view field in her, I’m using Nodejs with express This order view is of type INTEGER and has the constraints of NOT NULL and UNIQUE Inserting a new record may bring problems with that, because, if the existing records have view orders of, say, [1, 2, 3, 4, 5], an…
Is there an Azure SQL Database equivalent to MySQL’s “CHECKSUM TABLE”, and should it be used to check if two tables are identical?
I was looking for a way to check if two tables in the same database are identical (both contents and schema), and came over this question. The top answer for the question uses (from my understanding) a MySQL specific. When trying to run the code in an Azure SQL Database I get this error: Incorrect syntax near…
How to write SQL query without iterations
I have the following challenge: I have a table called hashtags_users_grouped which has the following structure: In each row, we find values that tell me when a certain user mentioned a certain hashtag and how many times he did it. In this example, user 1 mentioned hashtag 123 one time and 245 three times, whi…
Generate Scripts to move a database from one server to another
I want to move a database from our testing server to my local server. I don’t have the option of back up and restore since I don’t have permission. So I decided to use the generate script option to create all the scripts for the DB and then move over the database to my local server. The problem I&…
Using Variables in a MSAccess Function with SQL
I’m struggling with entering a custom made ID number on all my tables to link all records together, trying out normalization. I have an EmployeeDetails table and a LoginDetails table. Its my understanding that I need a field called EmployeeID on both and I can use the SQL Select code I have to pull the …
How to insert result of select query (with default if return no rows) as part of Postgres Function?
For my Nextjs website, I am configuring the backend to automatically add user information to a public.profiles table whenever a row is inserted into the auth.users table (automatically done through Supabase’s authentication). I have a public.college_emails table that contains the names of over 1700 coll…